Page 1 of 1

Amperstand in my url is preventing validation

Posted: Tue Mar 28, 2006 5:08 pm
by Luke
I have function that looks like this:

Code: Select all

function popup(image_name, border){
	  var newWindow = window.open("display_img.php?img=" + image_name + "&border=" + border, "display", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=750", "");
  }
The amperstand symbol causes the page to not validate as XHTML, but if I use & the script doesn't work... anybody know how I could fix this?

Posted: Tue Mar 28, 2006 5:29 pm
by Buddha443556
Perfection is sometimes over rated.

J/K

How about moving the Javascript to a file and importing it?

Posted: Tue Mar 28, 2006 5:32 pm
by feyd
or just mark the Javascript as random data to XHTML.. like telling it the Javascript is CDATA, or a comment.

Posted: Wed Mar 29, 2006 2:40 am
by RobertGonzalez
Is your JS inside of the output html? I think if it is a referenced file (<link rel=...) it is not included in the validation check. I am not reay sure about this so this is just a thought.

Posted: Wed Mar 29, 2006 2:42 am
by JayBird
Just FYI - it is Ampersand not Amperstand ;)

Posted: Wed Mar 29, 2006 5:00 am
by Roja
Everah wrote:Is your JS inside of the output html? I think if it is a referenced file (<link rel=...) it is not included in the validation check. I am not reay sure about this so this is just a thought.
Exactly right. Move the js out to a seperate file. As an added bonus, then it will cache for users after the first visit.