掲示板

how to add java script in velocity file

11年前 に Zoheb Athar Siddiqui によって更新されました。

how to add java script in velocity file

New Member 投稿: 24 参加年月日: 12/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
thumbnail
11年前 に Nagendra Kumar Busam によって更新されました。

RE: how to add java script in velocity file

Liferay Master 投稿: 678 参加年月日: 09/07/07 最新の投稿
You can include javascript in velocity templates - that's no problem.
thumbnail
11年前 に Nitesh Sahay によって更新されました。

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 ...