页面的滚动文字内容是由前一个页面的文本输入域得到的。
但只要在前一个页面的文本输入域中敲回车,滚动文字将无法运行并显示“未结束的字符串常量”的错误提示。怎么解决?显示滚动文字的jsp页面代码如下:String disp1 = request.getParameter("intruduce")
<SCRIPT language=javascript>
var disp="<%= disp1%>";
document.write('<marquee direction="up" height="150" id="scrollArea" onmouseout="scrollArea.start()" onmouseover="scrollArea.stop()" scrollamount="1" scrolldelay="60" width="250"><p> <font color="<%= getpara1.getparam("intrcolor")%>" >');
document.write(disp);
document.write('</p></marquee>');
</SCRIPT>
function Str2Html(str)
dim result
dim l
if isNULL(str) then
Str2Html=""
exit function
end if
l=len(str)
result=""
dim i,j
j=0
for i = 1 to l
if case mid(str,i,1)= chr(13) then
result=result+"<br>"
end if
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
next
Str2Html=result
end function把你上面的字幕内容部分先用这个函数处理一下
"<p> <font color="<%= getpara1.getparam("intrcolor")%>" >
改为
"<p> <font color="<%= Str2Html(getpara1.getparam("intrcolor"))%>" >