www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] why dosnt this simple script work? (it short plz help)

  1. #1
    Join Date
    Jul 2010
    Posts
    71

    resolved [RESOLVED] why dosnt this simple script work? (it short plz help)

    Code:
    <script type="text/javascript">
    var d=1;
    
    if (d < 10) 
      {
      document.write("<b>Good morning</b>");
      }
    </script>

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Because you have other problems elsewhere. JavaScript enabled? Have you a test page where it doesn't work?

  3. #3
    Join Date
    Jul 2010
    Posts
    71
    yea i missed a colon above, any thoughts on this one?

    Code:
    <script type="text/javascript">
    var h=20;
    if (h > 15)
      {
      document.write("Application Wait In 23:59:59");
      }
    else if (h <= 15)
      {
      document.write("Application Time 5:00:30");
      }
    else
      {
      code to be executed if condition1 and condition2 are not true
      }
    </script>

  4. #4
    Join Date
    Aug 2007
    Posts
    3,767
    Provided you comment out the line that isn't JavaScript in your second example, all the code you have posted here is syntactically perfect. You didn't miss any semi-colons in the first, and you can't have missed a colon in it because you only use a colon once in JavaScript and there are no examples of that in any sample you have posted.
    Code:
    else
      {
     // code to be executed if condition1 and condition2 are not true
      }

  5. #5
    Join Date
    Jul 2010
    Posts
    71
    Quote Originally Posted by Declan1991 View Post
    Provided you comment out the line that isn't JavaScript in your second example, all the code you have posted here is syntactically perfect. You didn't miss any semi-colons in the first, and you can't have missed a colon in it because you only use a colon once in JavaScript and there are no examples of that in any sample you have posted.
    Code:
    else
      {
     // code to be executed if condition1 and condition2 are not true
      }
    Thanks, i didnt know you had to comment the last part, i assumed since it didnt display the text it wasnt even getting that far.

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