Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Intervals and Auto Refresh (not AJAX)

    Hello

    I have a script where I'm using "AJAST" to load and execute new scripts on an interval, the relevant parts of the code are below:

    Code:
    <SCRIPT type="text/javascript">
    		function refpage(){
    			var head = document.getElementsByTagName('head')[0]
    			var node = ""
    			var node = document.createElement('script')
    			node.type = 'text/javascript'
    			node.src = 'refresh.php?d=29&m=07&y=2009'
    			head.appendChild(node)
    		}
    there are more functions before the end of the script tag, and then later:

    Code:
    <body>
    	<SCRIPT type="text/javascript">
    		setInterval(refpage(),10000)
    	</script>
    I had this working about a month ago, but now that I've come back to add things to the rest of the system it appears to have stopped

    Either I have changed something in this code accidently or have somehow gone back to an older version, as I remember fixing this before (but not how I did so)

    The function works when called by a button elsewhere on the page, but the interval doesn't operate on any of the browsers that I've tested with (IE6, IE7 and Firefox3)
    Last edited by AndP; 07-29-2009 at 01:43 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    <SCRIPT type="text/javascript">
    setInterval("refpage()",10000);
    </script>

    The name of the function called by setIinterval() must be in quotes.

    "Money does not bring happiness, but it does enable you to be miserable in comfort". - Philip M's personal mantra

  • Users who have thanked Philip M for this post:

    AndP (07-29-2009)

  • #3
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    heh, thanks, its always something mind boggelingly simple


  •  

    Posting Permissions

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