我在JSP adobe Cq5中使用了以下scriptlet,現在正在稍微遷移到Adobe。 有下面的代碼,這將在點擊錨鏈接打開一個新窗口,相同的功能必須把它寫在slightly..can你請幫我在這裏將JSP scriptlet轉換成Adobe Slightly?
------------------ if(!properties.get("buttonlabel","").equals("")){
String targetUrl ="#";
targetUrl = properties.get("buttonurl","#");
if(targetUrl.startsWith("/content")){
targetUrl = targetUrl+".html";
}
String target = "_self";
if(currentNode.hasProperty("openWindow")){
target = "_blank";
}
%>
<!--
<div class="fcdetails-button-holder">
<a href='<%=targetUrl%>' target ='<%=target%>' name='<%=properties.get("buttonlabel","Title")%> button' id="wp-ctoa_button" class="button" role="button"><%=properties.get("buttonlabel","Title")%></a>
</div>
-->
<div class="fcdetails-button-holder">
<button type="button" id="wp-ctoa_button" class="button" onclick="redirect()"><%=properties.get("buttonlabel","Title")%></button>
</div>
<script type="text/javascript">
function redirect()
{
var url = "<%=targetUrl%>";
window.open(url,"<%=target%>");
}
</script>