SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)

    setTimeout memory error

    Hey guys

    I have the following code in the body tags:
    Code:
    <script language="javascript">
    <!--
    function countdown()
    {
    document.forms.Form1.time.value=test
    setTimeout(countdown(),1000)
    }
    -->
    </script>
    It does write test to the textbox, but it gives an out of memory error. But if i take the setTimeout line out, then it still writes the string without any problems.

    Does anyone know what I can do 2 sort this out?

    Also above I am writing text to a text box, but want to use a similar method, but use images, can any1 tell me what control i can write to that will show images?

    I dnt no much about javascript, im just starting.

    Thanks for any help.

  2. #2
    SitePoint Addict dek's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're doing a nice spot of infinite recursion.

    Change the setTimeout line to:

    setTimeout(countdown,1000);

    And all will be well.
    Only dead fish go with the flow

  3. #3
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    Hey there dek... thanks a mil man. Its working now, but do u by any chance no what control I can use to put images in?

    Thanks

  4. #4
    SitePoint Addict dek's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you be a little more specific?
    Only dead fish go with the flow

  5. #5
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    Ok, well basically what i want to do is disply this text over another image, so i can not have it displayed in a text box. It does not matter anymore with a control that can have images.

    I want to put it on something like a panel or something that the user cannot see over a watermark with this text on it. I hope this makes sense

    Thanks

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <div id="thecountdown" style="background: url(myimage.jpg);"></div>

    then instead of using
    document.forms.Form1.time.value=test

    use
    document.getElementById("thecountdown").innerHTML = test;


Bookmarks

Posting Permissions

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