Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q5604

irt.org | About | Feedback | 1185 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q5604

Sent by
michel on May 05, 2000 at 15:37:08:

Comments:
The javascript and assumption on this page is not correct.I have had a few confused

var firstname = 'Jason'; // JavaScript variable containing firstname

var URL = eval('http://www.server.com/cgi-bin/script.pl?firstname=' + firstname);
document.location.href = URL;

1. Why the eval????
2. It is window.location, not document.location one should use.
document.location is in principle read only, It is only to be compatible with older wrong scripts that it is kept on as a location changer

I would code it like this:

var firstname = 'Jason';

window.location = 'http://www.server.com/cgi-bin/script.pl?firstname=' + firstname;

and it should be mentioned that the page the user is looking at will be replaced by whatever script.pl returns unless it returns a 304 nothing changed http header.

Michel


Other feedback on 'irt.org FAQ Knowledge Base Q5604' - show all


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.