homepage Welcome to WebmasterWorld Guest from 54.196.168.78
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
More JavaScript/HTML Validation errors
tesla




msg:1484815
 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);}
//--></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




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

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

andreasfriedrich




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

@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




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

uh, escape the double quotes?

\"

andreasfriedrich




msg:1484819
 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.

mivox




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

:) Two guesses down... next?

andreasfriedrich




msg:1484821
 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
?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]

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