Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can anyone tell me the problem of my SCRIPT ?

    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>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,727
    Thanks
    202
    Thanked 2,507 Times in 2,485 Posts
    The prompt staement needs to have a default value supplied.

    Code:
    <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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •