フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Zoheb Athar Siddiqui
how to add java script in velocity file
2012/05/28 23:16
答え

Zoheb Athar Siddiqui

ランク: New Member

投稿: 24

参加年月日: 2012/05/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/05/29 0:54
答え

Nagendra Kumar Busam

ランク: Liferay Master

投稿: 653

参加年月日: 2009/07/07

最近の投稿

You can include javascript in velocity templates - that's no problem.
Nitesh Kr Sahay
RE: how to add java script in velocity file
2012/05/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 ...