日期:2014-05-16  浏览次数:20412 次

有关字符转义的问题
实际需要把js的实现直接写到引用的地方,像这样
...   href= "javascript:

var   win   =   window.showModalDialog( " <%=appPath%> /plan/common/expert_iframe.jsp ", " ", "dialogHeight:580px;dialogWidth:800px   ;status=0;scroll=no;help=no; ");
if(win   !=   undefined   &&   win   !=   " "){
var   argumentId   =   " <%=argumentId%> ";

window.location.href= " <%=appPath%> /plan/planmaking/process/plan/expertargumentr.do?method=add&argumentId= "+argumentId+ "&expertId= "+win;

}

"
但是会出字符问题,不知道该怎样转义才可以,请教大家

------解决方案--------------------
... href= "javascript:

var win = window.showModalDialog( ' <%=appPath%> /plan/common/expert_iframe.jsp ', ' ', 'dialogHeight:580px;dialogWidth:800px ;status=0;scroll=no;help=no; ');
if(win != undefined && win != ' '){
var argumentId = ' <%=argumentId%> ';

window.location.href= ' <%=appPath%> /plan/planmaking/process/plan/expertargumentr.do?method=add&argumentId= '+argumentId+ '&expertId= '+win;

}

"


写个function不好么...
------解决方案--------------------
<a href= "javascript:a();function a(){alert( 'dfff ')}; " > dfff </a>