Jump to content
Sign in to follow this  
Antonio Testa

Script does not work as expected !!!

Recommended Posts

Hello folks,

My simple code bellow is not working !!!☹️. The value for <div "X0"> is updated only once. The value for <div "X2"> is never updated.

I want to have both X0 and X2 updated every second.... Any suggestion ?

Thanks a lot. Antonio... 

 

 

<html><head>

<script src="http://code.jquery.com/jquery-latest.js">

</script><script>

$(document).ready(function update(){

   $('#X0').load("urlforX0");

   $('#X2').load("urlforX2");

    setTimeout(update,1000);}

);

</script></head>

<body>

<div "X0"></div>

<div "x2"></div>

<script>update();</script>

</body>

</html>

 

Share this post


Link to post
Share on other sites

Hi Antonio

Your update function only gets defined once the page has loaded. You're calling update before its fully loaded. If you want to call it immediately, put the update() right after the function definition.

Share this post


Link to post
Share on other sites

The update() function will run when the page loads (it is being passed as an argument to the ready() function) , but it won't find the elements because they don't have id attributes.

Share this post


Link to post
Share on other sites

Hello, @Antonio Testa

Please try this code,To Script does not work as expected !!!

Move the following code from the <head> to just above the closing </body> tag

<script type="text/javascript">
   var c = document.id('right_column').getElement('#float_block');
   if (window.getSize().x < 1260 /*|| (c && t > p)*/){
      document.id('float_block').inject(document.id('float_block_default'));
   }
   else{
      if (!c)
         document.id('float_block').inject(document.id('right_column'));
   }
</script>

I hope this code will be useful.

Thank you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...