By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,228 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,228 IT Pros & Developers. It's quick & easy.

Problem validating HTML because of ASP code

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a


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/

Jul 20 '05 #2

P: n/a


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/

Jul 20 '05 #3

P: n/a
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
Jul 20 '05 #4

P: n/a
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
Jul 20 '05 #5

P: n/a
Martin Honnen wrote...
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.


Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D

--
Torbjørn Pettersen
Editor/Webmaster
FantaFiction

www.fantafiction.com
Jul 20 '05 #6

P: n/a
Martin Honnen wrote...
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.


Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D

--
Torbjørn Pettersen
Editor/Webmaster
FantaFiction

www.fantafiction.com
Jul 20 '05 #7

P: n/a
On Tue, 13 Apr 2004 18:23:01 +0200, "Torbjørn Pettersen" <tpe AT
broadpark DOT no> wrote:
Martin Honnen wrote...
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.


Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D


The next page will be a lot easier. Honest. :-)

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #8

P: n/a
On Tue, 13 Apr 2004 18:23:01 +0200, "Torbjørn Pettersen" <tpe AT
broadpark DOT no> wrote:
Martin Honnen wrote...
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.


Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D


The next page will be a lot easier. Honest. :-)

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #9

P: n/a
Stephen Poley wrote...
Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D


The next page will be a lot easier. Honest. :-)


I more or less expected it to be Hell. A combination of FrontPage and different
hand coders.... And I don't really know anything about CSS, started using it
this week. And I'm new to DreamWeaver too. ;-)

Well, learning as I go has proven to work before, and this group seems to be a
real treasure. :-) Friendly people who don't yell at newbies like me asking stupid
questions.

--
Torbjørn Pettersen
Editor/Webmaster
FantaFiction

www.fantafiction.com
Jul 20 '05 #10

P: n/a
Stephen Poley wrote...
Yes, that's what I wanted. :-) Thanks! My page is getting closer and closer
to being validated, just another couple of hours with blood, sweat and foul
language, and it should be done. :-D


The next page will be a lot easier. Honest. :-)


I more or less expected it to be Hell. A combination of FrontPage and different
hand coders.... And I don't really know anything about CSS, started using it
this week. And I'm new to DreamWeaver too. ;-)

Well, learning as I go has proven to work before, and this group seems to be a
real treasure. :-) Friendly people who don't yell at newbies like me asking stupid
questions.

--
Torbjørn Pettersen
Editor/Webmaster
FantaFiction

www.fantafiction.com
Jul 20 '05 #11

P: n/a
"Torbjørn Pettersen" <tpe AT broadpark DOT no> wrote in
news:40********@news.broadpark.no:
Well, learning as I go has proven to work before, and this group seems
to be a real treasure. :-) Friendly people who don't yell at newbies
like me asking stupid questions.


But you didn't ask a stupid question, even though the answer was obvious in
hindsight. You asked a smart question. You very concisely told us what
you were doing, what you wanted to happen, and what was actually happening
that you didn't want. And you also told us exactly why you wanted the
result that you weren't getting (it helps that the reason was something
that most of the regulars here regard as important).

When people get yelled at, it's usually because they leave out at least one
(often all four) of those key details and expect everybody to guess at
them. They give a vague description of a problem. They say "this doesn't
work" without saying what it's doing or what they want it to do. They post
15 screens of badly formatted code and just ask "how do I fix this?" They
get told what they need to do to fix their problem, and they refuse to do
it. They throw a fit if anybody points out lurking problems in their code,
problems that they didn't specifically ask about but that could bite them
later. They get mad if you tell them that what they want to do is a bad
idea, never mind that the reason experienced people say it's a bad idea is
that they've tried it themselves and gotten burned by it. They often
display a complete unwillingness to learn what they're doing; they treat
HTML, CSS, Javascript, etc. as sets of magic incantantions, asking "tell me
what to type to make this happen" without understanding any of the concepts
behind their code.

You didn't do any of those things. You clearly showed that while there was
a gap in your understanding, you were eager to fill it. You made it easy
and fun for people to help you. The next time you have a question that you
can't answer by consulting reference material, people will remember how
easy and fun it was to help you, and will be inclined to go a little out of
their way to do so. Because you've given them reason to believe that it
will actually do some good. Congratulations.
Jul 20 '05 #12

P: n/a
"Torbjørn Pettersen" <tpe AT broadpark DOT no> wrote in
news:40********@news.broadpark.no:
Well, learning as I go has proven to work before, and this group seems
to be a real treasure. :-) Friendly people who don't yell at newbies
like me asking stupid questions.


But you didn't ask a stupid question, even though the answer was obvious in
hindsight. You asked a smart question. You very concisely told us what
you were doing, what you wanted to happen, and what was actually happening
that you didn't want. And you also told us exactly why you wanted the
result that you weren't getting (it helps that the reason was something
that most of the regulars here regard as important).

When people get yelled at, it's usually because they leave out at least one
(often all four) of those key details and expect everybody to guess at
them. They give a vague description of a problem. They say "this doesn't
work" without saying what it's doing or what they want it to do. They post
15 screens of badly formatted code and just ask "how do I fix this?" They
get told what they need to do to fix their problem, and they refuse to do
it. They throw a fit if anybody points out lurking problems in their code,
problems that they didn't specifically ask about but that could bite them
later. They get mad if you tell them that what they want to do is a bad
idea, never mind that the reason experienced people say it's a bad idea is
that they've tried it themselves and gotten burned by it. They often
display a complete unwillingness to learn what they're doing; they treat
HTML, CSS, Javascript, etc. as sets of magic incantantions, asking "tell me
what to type to make this happen" without understanding any of the concepts
behind their code.

You didn't do any of those things. You clearly showed that while there was
a gap in your understanding, you were eager to fill it. You made it easy
and fun for people to help you. The next time you have a question that you
can't answer by consulting reference material, people will remember how
easy and fun it was to help you, and will be inclined to go a little out of
their way to do so. Because you've given them reason to believe that it
will actually do some good. Congratulations.
Jul 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.