Results 1 to 3 of 3

Thread: Syntax Error in my code. Help !

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Fixed!

    next please!

    Code:
    <HTML> 
    <HEAD> 
    <TITLE>Timer Function Example</TITLE> 
    
    <script langauge="JavaScript"> <!-- hide me 
    function alertIn2Secs() 
    { 
    
    the_timeout = setTimeout("document.writeln('Hello');", 2000); 
    
    } 
    
    // show me --> 
    
    </script> 
    
    </HEAD> 
    
    <BODY OnLoad="alertIn2Secs()"> 
    
    </BODY> 
    </HTML>
    Mark
    -------------------

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213
    Thanks mark,

    can you tell me is it possible to do the following or is my syntax incorrect again ?

    <HTML>
    <HEAD>
    <TITLE>Timer Function Example</TITLE>

    <script langauge="JavaScript">

    <!-- hide me

    var string1 = Hello"
    var string2 = "World"

    function alert1()

    {
    the_timeout = setTimeout("document.writeln(string1)", 1000); ("document.writeln(string2)", 2000);
    }

    // show me -->

    </script>


    </HEAD>


    <BODY OnLoad="alert1()">

    </BODY>
    </HTML>

    nmretd

  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    the document.write() function overwrites what is already there

    you can use alert()s though
    Code:
    <HTML> 
    <HEAD> 
    <TITLE>Timer Function Example</TITLE> 
    
    <script langauge="JavaScript"> 
    <!-- hide me 
    var string1 = "Hello";
    var string2 = "World";
    
    function alert1()
    {
     setTimeout("alert(string1)", 1000); 
     setTimeout("alert(string2)", 2000); 
    }
    // show me -->
    </script> 
    
    </HEAD>
    <BODY onload="alert1()"> 
     
    
    
    
    </BODY> 
    </HTML>
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width