...

View Full Version : Script worked locally but not on server



hcinderela
04-29-2008, 01:41 AM
I have a button on my page that calls this function. On my machine everything worked fine, but on the server after pushing the button, it does not pull up the prompt. It simply writes to the document with null.



function average(){
var num1 = prompt("Please enter a number","0");
var num2 = prompt("Please enter another number","0");
var num3 = prompt("Please enter a third number","0");
var avg = (parseInt(num1) + parseInt(num2) + parseInt(num3)) / 3;
document.write("You entered: ",num1,", ",num2,", and ", num3,"<br>");
document.write("Average: ",avg,"<br>");
}

mjlorbet
04-29-2008, 02:31 AM
this likely has to do with the way your button is calling the function, please paste that markup if your problem is not resolved by adjusting the security settings for your page.

hcinderela
04-29-2008, 02:52 AM
<input type="button" onclick="average()" value="Average Fun">


By the security settings, do you mean the permissions? I set them to 755.

mjlorbet
04-29-2008, 02:57 AM
no, i mean the settings on your browser that determine the zone permissions you have, it's possible your page is in the "restricted" zone and thus the scripts aren't bein allowed to run properly.

change the commas (,) in your document.write statements to the plus sign (+)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum