论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Zoheb Athar Siddiqui
how to add java script in velocity file
2012年5月28日 下午11:16
答复

Zoheb Athar Siddiqui

等级: New Member

帖子: 24

加入日期: 2012年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
Nagendra Kumar Busam
RE: how to add java script in velocity file
2012年5月29日 上午12:54
答复

Nagendra Kumar Busam

等级: Liferay Master

帖子: 653

加入日期: 2009年7月7日

最近的帖子

You can include javascript in velocity templates - that's no problem.
Nitesh Kr Sahay
RE: how to add java script in velocity file
2012年5月29日 上午2:29
答复

Nitesh Kr Sahay

等级: Junior Member

帖子: 58

加入日期: 2011年11月28日

最近的帖子

Hi zoheb,you can add javascript in velocity file similarly you used it in other ...