...

View Full Version : Can anyone tell me the problem of my SCRIPT ?



lala138
11-12-2004, 02:30 AM
Hi everyone, I don't know why I cannot display the prompt of the varialbe x,y,z,h,t ? May you tell me the error of where i do wrong ? I had the answer by using document.write but I did not show it here. Thanks a million !


<HTML>


<HEAD>CIS1.0 Professor Goldschmidt
</HEAD>


<Title><h1>H.w#9 JavaScript</h1></title>


<BODY>
<BR>

<P>

<center>
Welcome to my page


<Script language="javascript">


window.status="Thanks for visiting my page";


color=prompt("what color would you like for the background?");

document.bgColor=color;



color=prompt("what color would you like the text to be?");

document.fgColor=color;



color=prompt("What color would you like the visited links to be?");

document.vlinkColor=color;




</script>


<script>


x=prompt("What is your first name"?);

y=prompt("What is your last name"?);

z=prompt("What kind of food do you like?");

h=prompt("What kind of restaurants do you like to go to?");


t=prompt("What time of the day do you like to go out to eat?");





</script>



This is my favorite web page <a href="http://www.cars.com"> HERE. </a>
<p>

This is another web site you can check out<a href="http://www.jokes.com">HERE.</a>
<p>

This is another site.<a href="http://www.arutzsheva.com">HERE.</a>



</body>


</html>

Philip M
11-12-2004, 07:45 AM
The prompt staement needs to have a default value supplied.



<HTML>


<HEAD>CIS1.0 Professor Goldschmidt
</HEAD>


<Title><h1>H.w#9 JavaScript</h1></title>


<BODY>
<BR>

<P>

<center>
Welcome to my page


<Script language="javascript">


window.status="Thanks for visiting my page";


color=prompt("what color would you like for the background?", "");

document.bgColor=color;



color=prompt("what color would you like the text to be?", "");

document.fgColor=color;



color=prompt("What color would you like the visited links to be?", "");

document.vlinkColor=color;




</script>


<script>


x=prompt("What is your first name?", "");

y=prompt("What is your last name?", "");

z=prompt("What kind of food do you like?", "");

h=prompt("What kind of restaurants do you like to go to?", "");


t=prompt("What time of the day do you like to go out to eat?", "");



alert (x+y+z+h+t);

</script>



This is my favorite web page <a href="http://www.cars.com"> HERE. </a>
<p>

This is another web site you can check out<a href="http://www.jokes.com">HERE.</a>
<p>

This is another site.<a href="http://www.arutzsheva.com">HERE.</a>



</body>


</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum