我有这个代码..它是整体代码的一部分。
<%
dim rsFav
sSQL = "(SELECT shorthand, display, larry_ranking, site_url FROM larrydb_site_list lsl JOIN larrydb_review lr on lsl.sid = lr.sid WHERE display=true AND niche='regular' ORDER BY larry_ranking DESC Limit 2) UNION (SELECT shorthand, display, larry_ranking, site_url FROM larrydb_site_list lsl JOIN larrydb_review lr on lsl.sid = lr.sid WHERE display=true AND niche='regular' AND shorthand='sexier')"
Set rsFav = objConn.Execute(sSQL)
While NOT rsFav.EOF
%>
<tr><td>
<div style="background-image:url('images/<%=LCase(rsFav("shorthand"))%>_icon.png')" border="0" class="fav_site_icon">
<a href="http://livecamdeals.com/review.asp?sitename=<%=LCase(rsFav("shorthand"))%>"></a>
</div>
</td><td>
<a href='<%=LCase(rsFav("site_url"))%>' title="Visit <%=LCase(rsFav("shorthand"))%>.com" target="_blank" class="visit_site_icon <%=LCase(rsFav("shorthand"))%> special_<%=LCase(rsFav("shorthand"))%>"></a>
</td>
</tr></td>
<%
rsFav.MoveNext
wEnd
%>
一切都很好..发现这条线..
\ 我将网站名称视为空:
为什么?我对asp一无所知。我知道php&amp; asp.net .only
更新:这就是我得到的:
HTML输出。一个链接的示例:
<div style="background-image:url('images/.png')" border="0" class="fav_site_icon">
</div>
注意,上面......为图像打印速记..但不是链接..似乎是一个HTML问题
答案 0 :(得分:1)
将变量设置为rsFav(“速记”)返回的值,并在整个代码中引用该变量。
Dim shortHandId
While NOT rsFav.EOF
shortHandId = rsFav("shorthand")
%>
<tr><td>
<div style="background-image:url('images/<%=LCase(shortHandId)%>_icon.png')" border="0" class="fav_site_icon">
<a href="http://livecamdeals.com/review.asp?sitename=<%=LCase(shortHandId)%>"></a>
</div>
</td>
<td>
<a href='<%=LCase(rsFav("site_url"))%>' title="Visit <%=LCase(shortHandId)%>.com" target="_blank" class="visit_site_icon <%=LCase(shortHandId)%> special_<%=LCase(shortHandId)%>"></a>
</td>
</tr>
答案 1 :(得分:0)
尝试更改
<a href="http://example.com/review.asp?sitename=<%=LCase(rsFav("shorthand"))%>">
到
<a href='http://example.com/review.asp?sitename=<%=LCase(rsFav("shorthand"))%>'>
让href
使用单引号。