由于ASP代码验证HTML的问题 [英] Problem validating HTML because of ASP code

查看:65
本文介绍了由于ASP代码验证HTML的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在验证我的HTML代码时遇到了问题,因为我正在使用一些

ASP代码:


---启动代码 - -


<%

如果rs(Average)= 0那么

VotingImage ="< img src =" /images/0.gif" alt =''还没有投票''>"

ElseIf rs(" Average")> = 1和rs(Average)< 2然后

VotingImage ="< img src = / images / 1.gif alt =''1星满分6星''>"

结束If

%>


<! - 插入星星 - >

<%= VotingImage%>


---结束代码---


问题当然是代码插入,并在
中使用
最终结果中的HTML代码是:< img src = / images / 1.gif alt =''1星满分6星''>

属性值/ images / 1.gif for scr属性不包含在单个或

双引号中,因为它应该是,这导致代码不被验证为正确的
HTML。 : - /


我已经尝试用引号将它括在这个和那个方面,但它并没有
工作......和它让我疯了。 :-(


-

Torbj?Petteren

编辑/网站管理员

FantaFiction <

www.fantafiction.com

解决方案




Torbj?姓Pettersen写道:

我在验证时遇到问题我的HTML代码因为我正在使用的一些ASP代码:

---启动代码---

<%
如果rs(Average)= 0然后
VotingImage ="< img src =" /images/0.gif" alt =''还没有投票''>"
ElseIf rs(Average)> = 1和rs(Average)< 2然后
VotingImage ="< img src = / images / 1.gif alt =''1/6明星''>"




我想你想要

VotingImage ="< img src ="" / images /1.gif"" alt =""< 6 out of 6 starts"" ;>"

至少这是将双引号插入字符串文字的方式

with VBScript。

-


Martin Honnen
http:// JavaScript。 FAQTs.com/




Torbj?姓Pettersen写道:
< blockquote class =post_quotes>由于我正在使用的一些ASP代码,我在验证HTML代码方面遇到了问题:

---启动代码---

<%
如果rs(Average)= 0那么
VotingImage ="< img src =" /images/0.gif" alt =''还没有投票''>"
ElseIf rs(" Average")> = 1和rs(Average)< 2然后
VotingImage ="< img src = / images / 1.gif alt =''1星中的6星''>"




我想你想要

VotingImage ="< img src ="" /images/1.gif"" alt ="" 6个开始中的1个"">"

至少这是将双引号插入字符串文字的方式

with VBScript。

-


Martin Honnen
http://javaScript.FAQTs.com/


Torbj?姓Pettersen写道:

由于我正在使用的一些ASP代码,我在验证HTML代码方面遇到了问题:

<%
如果rs(Average ;)= 0然后
VotingImage ="< img src =" /images/0.gif" alt =''还没有投票''>"
ElseIf rs(" Average")> = 1和rs(Average)< 2然后
VotingImage ="< img src = / images / 1.gif alt =''1星中的6星''>"
结束如果
%>




ASP / VBScript


intAverage = rs.Fields.Item(" Average")。值

if(intAverage = 0)then

VotingImage =''< img src =" /images/0.gif" alt ="还没有投票">''

elseif(intAverage> = 1和intAverage< 2)然后

VotingImage =''< img src = QUOT; /images/1.gif" alt =" 1 out of 6 stars">''

结束如果

-

Andrew Urquhart

- 常见问题解答: www.htmlhelp.org/faq/html/

- 存档: www.tinyurl.com/2zw7m

- 联系方式: www.andrewu.co.uk/联系/

- 雇用我:前/中级ASP开发人员与WAI&网络标准


I''m having problems validating my HTML code because of some
ASP code I''m using:

---Start Code---

<%
If rs("Average") = 0 Then
VotingImage = "<img src="/images/0.gif" alt=''No votes yet''>"
ElseIf rs("Average") >= 1 And rs("Average") < 2 Then
VotingImage = "<img src=/images/1.gif alt=''1 out of 6 stars''>"
End If
%>

<!-- Insert stars-->
<%=VotingImage%>

---End Code---

The problem is of course that the code inserted, and used in the
HTML code in the end result is : <img src=/images/1.gif alt=''1 out of 6 stars''>
The attribute value /images/1.gif for the scr attribute isn''t enclosed in single or
double quotation marks as it should be, and this results in the code not being
validated as proper HTML. :-/

I have tried enclosing it in quotation marks both this and that way, but it doesn''t
work..... and it''s driving me nuts. :-(

--
Torbj?rn Pettersen
Editor/Webmaster
FantaFiction

www.fantafiction.com

解决方案



Torbj?rn Pettersen wrote:

I''m having problems validating my HTML code because of some
ASP code I''m using:

---Start Code---

<%
If rs("Average") = 0 Then
VotingImage = "<img src="/images/0.gif" alt=''No votes yet''>"
ElseIf rs("Average") >= 1 And rs("Average") < 2 Then
VotingImage = "<img src=/images/1.gif alt=''1 out of 6 stars''>"



I think you want
VotingImage = "<img src=""/images/1.gif"" alt=""1 out of 6 starts"">"
at least that is the way to insert a double quote into a string literal
with VBScript.
--

Martin Honnen
http://JavaScript.FAQTs.com/




Torbj?rn Pettersen wrote:

I''m having problems validating my HTML code because of some
ASP code I''m using:

---Start Code---

<%
If rs("Average") = 0 Then
VotingImage = "<img src="/images/0.gif" alt=''No votes yet''>"
ElseIf rs("Average") >= 1 And rs("Average") < 2 Then
VotingImage = "<img src=/images/1.gif alt=''1 out of 6 stars''>"



I think you want
VotingImage = "<img src=""/images/1.gif"" alt=""1 out of 6 starts"">"
at least that is the way to insert a double quote into a string literal
with VBScript.
--

Martin Honnen
http://JavaScript.FAQTs.com/


Torbj?rn Pettersen wrote:

I''m having problems validating my HTML code because of some
ASP code I''m using:

<%
If rs("Average") = 0 Then
VotingImage = "<img src="/images/0.gif" alt=''No votes yet''>"
ElseIf rs("Average") >= 1 And rs("Average") < 2 Then
VotingImage = "<img src=/images/1.gif alt=''1 out of 6 stars''>"
End If
%>



ASP/VBScript

intAverage = rs.Fields.Item("Average").Value
if (intAverage = 0) then
VotingImage = ''<img src="/images/0.gif" alt="No votes yet">''
elseif (intAverage >= 1 and intAverage < 2) then
VotingImage = ''<img src="/images/1.gif" alt="1 out of 6 stars">''
end if
--
Andrew Urquhart
- FAQ: www.htmlhelp.org/faq/html/
- Archive: www.tinyurl.com/2zw7m
- Contact: www.andrewu.co.uk/contact/
- Employ me: Front/middle tier ASP developer with WAI & web standards


这篇关于由于ASP代码验证HTML的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆