Forum Moderators: open

Message Too Old, No Replies

Error in Validation

JavaScript link issues

         

CSS_Kidd

1:33 pm on Jun 10, 2009 (gmt 0)

10+ Year Member



Upon validating one of my sites I came up with numerous errors for one line that is in a JavaScript tag where the src='' calls a little weather widget type thing:

<script type="text/javascript" src='foo.asp?(with a string of =, &, zipcode, tStyle, and others)'></script>

It is giving me errors based on the =, &, listed with in the links.

My Doctype is XHTML 1.0 STRICT

What is a good way to clear this up? Or should I just ignore the errors?

birdbrain

3:02 pm on Jun 10, 2009 (gmt 0)



Hi there CSS_Kidd,

try changing all occurrences of "&" to "&amp;".

birdbrain

CSS_Kidd

3:22 pm on Jun 10, 2009 (gmt 0)

10+ Year Member



Birdbrain

is that ok to put in an address line like this: "<script type="text/javascript" src=http://foo.asp?=0&zipcode=65616&lang=eng&size=8&theme=blue&metric=0&target=_self"

because the validation is giving me errors on the =s as well. Changing them all to &amp; or &----; will mess up the address and will not show the content needed.

birdbrain

3:50 pm on Jun 10, 2009 (gmt 0)



Hi there CSS_kidd,

"With HTML, the browser translates "&amp;" to "&" so the Web server
would only see "&" and not "&amp;" in the query string of the request."

Source:-


birdbrain

CSS_Kidd

4:06 pm on Jun 10, 2009 (gmt 0)

10+ Year Member



Works! Thank you!

First time using strict with a link like this.

birdbrain

4:46 pm on Jun 10, 2009 (gmt 0)



No problem, you're very welcome. ;)