留言板

how to add java script in velocity file

Zoheb Athar Siddiqui,修改在11 年前。

how to add java script in velocity file

New Member 帖子: 24 加入日期: 12-5-15 最近的帖子
Hi,

i am new in liferay , i have a situation where there are few tabs in the application say 2 tabs , on mouse over on any of the tab on status bar user can see the navigation
URL and can move to any of the tab by putting that URL on the address bar though it is disable for him.so therefore i have to hide that status bar text and want to show
something different . not the actual URL. therefore i have made use of javascript my question is that

1) can we use javascript on the navigation.vm file
2)is there some configuration in liferay that this can be done through liferay configutation.

i have used this code in my navigation.vm file

<script language="javascript" type="text/javascript">
function redirect(URL)
{
document.location=URL;
return false;
}
</script>




#if($nav_item.getName() == "Profile" )
<a class="$nav_has_child" href="javascript:void(0)"
onclick="return redirect('/group/kaspersky/basic $nav_item.getTarget()')"><span>$nav_item.getName()</span></a>
#end

#if($nav_item.getName() == "PA" )
<a class="$nav_has_child" href="javascript:void(0)" onclick="return redirect('/group/kaspersky/list $nav_item.getTarget()')" ><span>$nav_item.getName()</span></a>
#end

is this fine any sugesstion would be a great help for me
thumbnail
Nagendra Kumar Busam,修改在11 年前。

RE: how to add java script in velocity file

Liferay Master 帖子: 678 加入日期: 09-7-7 最近的帖子
You can include javascript in velocity templates - that's no problem.
thumbnail
Nitesh Sahay,修改在11 年前。

RE: how to add java script in velocity file

Junior Member 帖子: 58 加入日期: 11-11-28 最近的帖子
Hi zoheb,you can add javascript in velocity file similarly you used it in other ...