Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JavaScript real time

Featured Replies

Hey,

 

my first question is where is the JavaScript forum/section on this board ?

 

And my problem is I want a real time function in JavaScript to put on my site. I had a PHP clock before but you have to refresh it to see that the time changes, I'd like to make a clock wit js that changes every second, you see what I mean ? Any idea how to do that ?

 

thanks. Revs :p.

 

Edit : whoops found a topic about that, works now. Sorry for creating a new topic, did not find any delete button …

Hey,

 

my first question is where is the JavaScript forum/section on this board ?

 

And my problem is I want a real time function in JavaScript to put on my site. I had a PHP clock before but you have to refresh it to see that the time changes, I'd like to make a clock wit js that changes every second, you see what I mean ? Any idea how to do that ?

 

thanks. Revs :p.

Hi i am no expert but i have a simular problem refreshing a page on a chat room i made i at to use ajax periodic updater script i havent got arround to doing it yet but here is the code i was given

 

<script type="text/javascript">

function ajaxread()

{

var ajaxread;

try

{ ajaxread=new XMLHttpRequest(); }

catch (e)

{

try

{ ajaxread=new ActiveXObject("Msxml2.XMLHTTP"); }

catch (e)

{

try

{ ajaxread=new ActiveXObject("Microsoft.XMLHTTP"); }

catch (e)

{

document.write("This page needs AJAX to run");

return false;

}

}

}

ajaxread.onreadystatechange=function()

{ if(ajaxread.readyState==4) {

document.getElementById("chat").innerHTML=ajaxread.responseText;

}

}

ajaxread.open("GET","read.php",true);

ajaxread.send(null);

}

 

function readalways()

{

setTimeout("ajaxread()",2500);

setTimeout("readalways()",2500);

}

readalways();

</script>

<div id="name of div">text goes here

</div>

 

hope it helps

  • Author

Everything that appears is the text goes here in the DIV, I don't see the time :/. But thanks.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.