dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: Java script cold you please tell me why the lat document.writreln() wont print ?

  1. #1
    Join Date
    Nov 2014
    Posts
    11

    Java script cold you please tell me why the lat document.writreln() wont print ?

    ,html]
    <head>
    <title>My real atempt</title>
    </head>

    <body>
    <script>
    var nameStr = prompt("what is your first name");
    var dobStr = prompt("What is your date of birth","25 MAR 1970");
    document.writeln('<h1><strong>Introduce yourself</strong></h1><hr>');
    document.writeln('<h2><ul><li>My Name is : <font color ="red" >'+nameStr+' </font></li> </h2>');
    var dayArray = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

    dobArray = dobStr.split(" ");
    var dayStr = dobArray[0];
    var month = dobArray[1];
    var year = dobArray[2];
    var dobDate = new Date()
    dobDate = (year,month,day);
    document.writeln('<li>I was born on a '+(datArray[1])+':');

    </script>


    </body>
    </html>
    [html]

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,505
    Beside the typing and syntax errors,
    I can find only one reference to a 'datArray'
    and that is in your questioned statement.

    Note: You will need to become a bit more careful with your typing skills if you want to become a "good" programmer.
    A poor typist is also a poor programmer.

  3. #3
    Join Date
    Nov 2014
    Posts
    11

    sorry, it was dayArray and i cant find the syntax error in last line

    html]
    <head>
    <title>My real atempt</title>
    </head>

    <body>
    <script>
    var nameStr = prompt("what is your first name");
    var dobStr = prompt("What is your date of birth","25 MAR 1970");
    document.writeln('<h1><strong>Introduce yourself</strong></h1><hr>');
    document.writeln('<h2><ul><li>My Name is : <font color ="red" >'+nameStr+' </font></li> </h2>');
    var dayArray = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

    dobArray = dobStr.split(" ");
    var dayStr = dobArray[0];
    var month = dobArray[1];
    var year = dobArray[2];
    var dobDate = new Date()
    dobDate = (year,month,day);
    document.writeln('<li>I was born on a '+(dayArray[1])+':');

    </script>


    </body>
    </html>
    [html]

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,505

    Exclamation

    Use the error console to see the obvious errors.

    You NEVER define a "day" anywhere before you try to use it.
    See the
    Code:
    dobDate = (year,month,day);
    assignment statement and note that that statement does nothing even when corrected!

  5. #5
    Join Date
    Nov 2014
    Posts
    11
    Thanks, I'd given different variable names, or used a name i thought id used as as a variable. I could not find the wood for the trees

    thank you.

  6. #6
    Join Date
    Dec 2014
    Posts
    7
    nice

  7. #7
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,505
    Quote Originally Posted by carlyn View Post
    Thanks, I'd given different variable names, or used a name i thought id used as as a variable. I could not find the wood for the trees

    thank you.
    You're most welcome.
    Happy to help.
    Good Luck!

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