I tried to use wiki="false", or remove //<![CDATA[ and //]]>, still the
event callback function never get called, any other reason?
Thanks for your response, please help.
Dave
On Wed, Apr 18, 2012 at 5:33 AM, Marius Dumitru Florea <
mariusdumitru.florea(a)xwiki.com> wrote:
Hi Dave,
On Wed, Apr 18, 2012 at 6:43 AM, du du <dddu88(a)gmail.com> wrote:
Hi all,
I have the following velocity code in xwiki page, I can see the fid and
fname values when I retrieve entryobj from the server side, so I want to
use javascript to add the fid and fname to image link node as parameters
of
the href url. the problem is the javascript
loaded event function never
got
called, why?
Thanks very much.
Dave
{{velocity filter="none"}}
{{html clean="false" wiki="true"}}
<script type="text/javascript">
//<![CDATA[
wiki="true" causes // to generate an EM HTML tag. Just look at the
page HTML source (all browsers have this option) and you'll see that
your SCRIPT tag is messed up.
My advice is to:
* use a JavaScript extension (
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HM…
) instead of in-line SCRIPT tag
* try to avoid HTML macro with wiki="true" or, if it's not possible,
try to reduce as much as possible its content, i.e. wrap only the code
that really needs it.
Hope this helps,
Marius
document.observe("xwiki:dom:loaded",
function(){
var imageNode = document.getElementById('tmViewImages');
var url = imageNode.href;
var index = url.indexOf("?");
if(index!=-1)
url = url.substring(0,index-1);
url=url+"?FID=$!fid&FName=$!fname";
imageNode.href=url;
//]]>
</script>
#getEntryItemObject($doc $entryObj)
#if("$!entryObj" == '')
#warning($msg.get('xe.blog.sheet.notpost'))
## Keep testing the inline action for backward compatibility with older
blog posts.
#elseif($xcontext.action != 'edit' && $xcontext.action !=
'inline')
## View mode
#set($fid=$entryObj.getProperty('FID').value)
#set($fname=$entryObj.getProperty('FName').value)
fid view: $fid
fname view: $fname
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users