Welcome to WebmasterWorld Guest from 54.242.94.72

Forum Moderators: open

Message Too Old, No Replies

More JavaScript/HTML Validation errors

     

tesla

5:55 pm on Sep 11, 2002 (gmt 0)

10+ Year Member



Here is an easy one for you javascript folks. The following fails in the W3C validator. The error is:

Error: end tag for element "A" which is not open; try removing the end tag or check for improper nesting of elements.
It points at the "</a>" element. I suspect it is something simple, but I'm simple when it comes to javascript.

<script type="text/javascript" LANGUAGE="javascript"><!--
if (t==0) { var h='<a href="http://tools.hitbox.com/bin/tellafriend/tellafriend.cgi
?client_id=66576&tool_instance_id=1&action=tell">Tell-A-Friend</a>'; document.write(h);}
//--></script>

Thanks,

Actually, I have decided to yank this crap out. THis was generated by Hitbox and is a tell-a-friend tool. But as I considered what it offeres above and beyond just a pop-up email, I realized it has no value. So the question is still an interesting one, but I'm deleting this.

THanks again.

[edited by: tesla at 6:22 pm (utc) on Sep. 11, 2002]

[edited by: tedster at 1:08 am (utc) on Sep. 12, 2002]

mivox

6:01 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member mivox is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Umm... try changing the quotes inside the <a> tag to single ' instead of double " quotes?

andreasfriedrich

6:05 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



@mivox

Then youŽll get a JavaScript error since the string that gets assigned to h will end after the "href" and the following URL is not legal JavaScript syntax.

bobriggs

6:07 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



uh, escape the double quotes?

\"

andreasfriedrich

6:22 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why would one want to do that? " are perfectly legal in a ' delimited string. And I checked it, it doesnŽt fix the problem.

mivox

6:23 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member mivox is a WebmasterWorld Top Contributor of All Time 10+ Year Member



:) Two guesses down... next?

andreasfriedrich

6:25 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<script type="text/javascript" LANGUAGE="javascript">
<!--
if (t==0) { document.write('<a href="http://tools.hitbox.com/bin/tellafriend/tellafriend.cgi
?client_id=66576&tool_instance_id=1&action=tell">Tell-A-Friend<\/a>');}
//-->
</script>

This one works. Notice the "<\/a>".

[edited by: tedster at 1:09 am (utc) on Sep. 12, 2002]
[edit reason] stop side scrolling [/edit]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month