日期:2014-05-17  浏览次数:21044 次

传递的参数是这种情况怎么办?
在程序中,我是这样传递参数给JS处理的。。

<img   src= "../images/ <%=rs2( "imgsmall ")%> "   onMouseDown= "fs( '../images/ <%=rs2( "imgbig ")%> ', ' <%=rs2( "size ")%> ') "   style= "cursor:hand ">


在JS代码如下:
<script   language= "javascript ">
function   fs(im,size)
{
img1.src=im

document.getElementById( "gui ").innerHTML   =   size


}
</script>

如果字段size里包括了这样的形式:19 "(25*25),JS脚本就会出错,我该如何办呢?谢谢!


------解决方案--------------------
<%=replace(rs2( "size "),chr(34), "\ " & chr(34))%>
------解决方案--------------------
最簡單的辦法就是
<img src= "../images/ <%=rs2( "imgsmall ")%> " onMouseDown= "fs( ' <%=server.htmlencode( "../images/ "&rs2( "imgbig ")& " ")%> ', ' <%=rs2( "size ")%> ') " style= "cursor:hand ">

經過測試,無誤!