0

我有这个代码..这是整个代码的一部分。

    <%
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和asp.net .only

更新:这就是我得到的:

HTML 输出。一个链接的例子:

<div style="background-image:url('images/.png')" border="0" class="fav_site_icon">



                </div>

注意,上面..为图像打印了简写..但不是为链接..似乎是一个html问题

4

2 回答 2

1

将变量设置为 rsFav("shorthand")) 返回的值,并在整个代码中引用它。

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>
于 2012-05-02T08:46:31.087 回答
0

尝试改变

<a href="http://example.com/review.asp?sitename=<%=LCase(rsFav("shorthand"))%>">

进入

<a href='http://example.com/review.asp?sitename=<%=LCase(rsFav("shorthand"))%>'>

让您href使用单引号。

于 2012-05-02T07:39:00.183 回答