You are here: 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