www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help I cant seem to figure this out

Hybrid View

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    Question Help I cant seem to figure this out


    I am suppose to write a function that uses a while loop that prompts the user for only 9 char and may not include spaces. What im doing is not even showing the prompt. Help
    function Secret()
    {
    var secretcode = prompt("Enter Po's secret word. It must contain exactly 9 characters and there can be no empty spaces:","");
    var code=secretcode.indexOf(" ");
    var space==true;

    while(space==false)
    {
    if (code.indexOf(" ")>="0")
    {
    space==true;
    document.getElementById("results").innerHTML += (secretcode);<!--output the result of what was imputed for the secret word-->
    }
    if (code.indexOf(9)==/d)
    {
    space==false;
    secretcode= prompt("Please reenter Po's secret word. It must contain exactly 9 characters and there can be no empty spaces:","");
    }
    else
    document.getElementById("results").innerHTML += (secretcode);<!--output the result of what was imputed for the secret word-->
    else
    secretcode= prompt("Please reenter Po's secret word. It must contain exactly 9 characters and there can be no empty spaces:","");
    }

  2. #2
    Join Date
    Nov 2013
    Posts
    5
    I don't do javascript programming but I do know that you should be using a single equal sign rather than a double equal sign when assigining a value to a variable. I think it's only in an If statement that you use the equal sign.

    Worth checking into.

    Kelly

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles