<td height="30" width="320" onmouseover="test(imgnum)"><font size="2px"><a href="../newss.asp" target="_blank"></a></font></td>
其中imgnum是一个变量
我想把上述内容付给一个字符串
就是 str="<td>....</td>"
请问格式怎么写?
其中imgnum是一个变量
我想把上述内容付给一个字符串
就是 str="<td>....</td>"
请问格式怎么写?
str=str + "<td onmouseover='test("+ imgpath +")'><font size='2px'><a href='../newss.asp?id="&rs("id")&"' target='_blank'>"& title &"</a></font></td>"
为什么运行时报错?
如果都是服务器端变量str = str + "<td onmouseover=\"test('<%=imgpath%>')\"><font size='2px'><a href='../newss.asp?id=<%=rs("id")%>' target='_blank'><%=title%></a></font></td>";
中间还是有双引号啊,改成单引试试看
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
sql2="select * from NEWS where BigClassName='ChuShi' order by ID DESC"
rs.Open sql2,conn,1,1for j=1 to 8
title=cstr(rs("title"))
imgpath=cstr(rs("firstImageName"))
%>
<%
if imgpath="" then
str="<td height='30' width='30'><img src='zanwu.gif' width='28' height='28' id=''></td><td height='30' width='100'></td>"
else
str="<td height='30' width='30'><img src='../admin/eWebEditor/UploadFile/"& imgpath &"' width='28' height='28' id='"& imgpath &"'></td><td height='30' width='100'></td>"
end if
%>
<%
str=str + "<td onmouseover='test("+ imgpath +")'><font size='2px'><a href='../newss.asp?id="&rs("id")&"' target='_blank'>"& title &"</a></font></td>"
%>
<%
response.Write(str)
%>
<%rs.movenext
if rs.eof then exit fornext
%>
请问各位高手,代码的语法有什么问题?
为什么系统报错?
Set rs = CreateObject("ADODB.RecordSet")
sql2 = "select Top 8 * from NEWS where BigClassName='ChuShi' order by ID DESC"
rs.CursorLocation = 3
rs.Open sql2,conn,1,1 Do While Not rs.EOF
title = Trim(rs("title").Value)
imgpath = Trim(rs("firstImageName").Value) If imgpath = "" Then
str = "<td height='30' width='30'><img src='zanwu.gif' width='28' height='28' id=''></td><td height='30' width='100'></td>"
Else
str = "<td height='30' width='30'><img src='../admin/eWebEditor/UploadFile/" & imgpath & "' width='28' height='28' id='" & imgpath & "'></td><td height='30' width='100'></td>"
End if
str = str & "<td onmouseover=""test('" & imgpath & "');""> <font size='2px'><a href='../newss.asp?id=" & rs("id") & "' target='_blank'>" & title & "</a></font></td>"
Response.Write str
rs.MoveNext
Loop
rs.Close
conn.Close
%>