admin管理员组文章数量:1394066
<ul id="option5" class="abc">
<#list (optionsSelected)! as options>
<li class=" ${options_index+1}">
<a href ="${options_url}">
${options_description}
</a>
</li>
</#list>
</ul>
<a href="${content_url}" onClick="abc()"; return false;">
<script>
function abc(){
$('.nav_header li').click(function () {
var blah = $(this).children().attr('href');
etc
etc ....
return false;
}).filter(':first').click();
}
</script>
My output looks like this with the above code:
option1 option2 option3 option4 option5
When I click on option 1 I want to see the "hey I'm option1" When I click on option 1 I want to see the "hey I'm ur second option" When I click on option 1 I want to see the "hey whats up I'm 3" etc without the page reloading.
I want to know how can I get this behavior in freemarkeR? I have my js code for this but how do I put this in freemarkeR? I cannot find good examples of javascript integrated with freemarker. I'm quite new to freemarker,
<ul id="option5" class="abc">
<#list (optionsSelected)! as options>
<li class=" ${options_index+1}">
<a href ="${options_url}">
${options_description}
</a>
</li>
</#list>
</ul>
<a href="${content_url}" onClick="abc()"; return false;">
<script>
function abc(){
$('.nav_header li').click(function () {
var blah = $(this).children().attr('href');
etc
etc ....
return false;
}).filter(':first').click();
}
</script>
My output looks like this with the above code:
option1 option2 option3 option4 option5
When I click on option 1 I want to see the "hey I'm option1" When I click on option 1 I want to see the "hey I'm ur second option" When I click on option 1 I want to see the "hey whats up I'm 3" etc without the page reloading.
I want to know how can I get this behavior in freemarkeR? I have my js code for this but how do I put this in freemarkeR? I cannot find good examples of javascript integrated with freemarker. I'm quite new to freemarker,
Share Improve this question edited Jul 22, 2014 at 22:36 user3861516 asked Jul 22, 2014 at 16:38 user3861516user3861516 611 gold badge1 silver badge3 bronze badges1 Answer
Reset to default 2That is not really freemarker problem, JS doesn't bother about your server side technology.
I would do something like:
<a href ="${options_url}" onClick="alert('${options_description}'); return false;">
${options_description}
</a>
So, as you see, tricky part is only to tread your freemarker variable as a correct JS string - using '
or "
(where it is allowed).
本文标签: freemarker integrated with javascriptStack Overflow
版权声明:本文标题:freemarker integrated with javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744622849a2616133.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论