homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

More JavaScript/HTML Validation errors

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

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);}


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]



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

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


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


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.


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

uh, escape the double quotes?



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

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


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

:) Two guesses down... next?


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

<script type="text/javascript" LANGUAGE="javascript">
if (t==0) { document.write('<a href="http://tools.hitbox.com/bin/tellafriend/tellafriend.cgi

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

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved