![]() |
|
|
With this little piece of code, it's possible to to transfer values between pages, just like if you were using a serverside language, like php, jsp or asp. Yeah, I know this is a php file, but I promise you, that is works with an ordinary html file too... Try changing the values in the address-field and see the result below. |
|
|
Comments availble in "View source"-mode
// This function extracts the values from the url
function getValues(){
var urlEnd = document.URL.indexOf('?');
var values = new Array();
var names;
if (urlEnd != -1){
var params = document.URL.substring(urlEnd+1, document.URL.length).split('&');
for(i=0; i<params.length; i++) {
names = params[i].split('=');
values[names[0]] = names[1];
}
}
return values;
}
values = getValues();
// Define your names here
var author = unescape(values["author"]);
var content = unescape(values["content"]);
|
|
|
|