MindTouch Developer Center > DekiScript > Samples/FAQ > How do I... Create a dynamic link on an image?
Table of contents
No headers

The editor tends mess up DekiScript when used inside "src" or "href" attributes.  The work around is to use the web.html function to dynamically generate the desired HTML code on the fly.

{{ 
  var parent = page.parent; 
  if(parent) { 
    web.html('<a href="' .. parent.uri .. '"><img src="/skins/common/images/nav-parent-docked.gif" /></a>') 
  } 
}}

Here is the output:

Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.1a