Home > Web Front-end > HTML Tutorial > html splicing problem_html/css_WEB-ITnose

html splicing problem_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:12:48
Original
1164 people have browsed it

I don’t know much about web development, but I need to modify some asp things. When I spell html, I always make mistakes, sometimes "sometimes' sometimes&", I feel dizzy. I know the main reason is that I am not very good at this aspect. I understand, but the writing style of html and javascript is too "loose" or too loose, unlike C#.
There is a statement that cannot be spelled. Help:
is a statement that dynamically outputs query results. rs is the result. Set

Response.Write"<table align=center bgcolor='#666666' border=0 cellpadding=1 cellspacing=0 ><tbody><td><a href='a.asp?id="&rs("id")&"' target='_blank'><img src="&rs("id")&" border='0' width=160 height=160 onmouseover=showBigImg(<img src="&rs("img")&">) onmouseout=showBigImg() ></a></td></tbody></table><br><a href='a.asp?id="&rs("id")&"' target='_blank'>"&rs("name")&"</a></td>"
Copy after login

The main problem is here. This part was added. It was no problem before. Now I need to add a function to display a large picture after the mouse is passed, but there is a syntax error in the html splicing
onmouseover=showBigImg(<img src="&rs("img")&">) onmouseout=showBigImg()
Copy after login


Reply to the discussion (solution)

Response.Write"<table align=center bgcolor=\"#666666\" border=0 cellpadding=1 cellspacing=0 ><tbody><td><a href=\"a.asp?id=\"&rs(\"id\")&\"\" target=\"_blank\"><img src=\"&rs(\"id\")&\" border=\"0\" width=160 height=160 onmouseover=showBigImg(<img src=\"&rs(\"img\")&\">) onmouseout=showBigImg() ></a></td></tbody></table><br><a href=\"a.asp?id=\"&rs(\"id\")&\"\" target=\"blank\">\"&rs(\"name\")&\"</a></td>";
Copy after login

Try to use " uniformly. "Use escape...

You can define a variable to receive the string... Then output this variable... See where there is a problem

dim a=rs("id");dim b=rs("img");dim c=rs("name");Response.Write "<table align=center bgcolor='#666666' border=0 cellpadding=1 cellspacing=0 ><tbody><td><a href='a.asp?id="+a+"'target='_blank'><img src='' border='0' width=160 height=160 onmouseover=showBigImg(<img src='"+b+"'>) onmouseout=showBigImg() ></a></td></tbody></table><br><a href='a.asp?id="+a+"' target='blank'>"+c+"</a></td>";
Copy after login

All Try it

The connection of vbscript is &
For example

response.write("

"&rs("col")&"
")
or
response.write("
"&rs("col")&"
")

The poster can check the source code of the page and see the difference

'color:red' prints out as single quotes

""color:red""> prints out as single quotes pair of double quotes

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template