Amperstand in my url is preventing validation

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Amperstand in my url is preventing validation

Post 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?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Perfection is sometimes over rated.

J/K

How about moving the Javascript to a file and importing it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

or just mark the Javascript as random data to XHTML.. like telling it the Javascript is CDATA, or a comment.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Just FYI - it is Ampersand not Amperstand ;)
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post 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.
Post Reply