Link to home
Start Free TrialLog in
Avatar of CongUan
CongUan

asked on

How to do refresh page with JAVA SCRIPT

Hi Experts,

I have question about how to do refresh the pages with JAVA SCRIPT base on some issues as below:

- I have 3 banner images, each image link to orther URL when user click on the banner image.
- I have a banner html page that are display banner images by rotating with 10 sec

So, How to do this by using 1 HTML page and JAVA SCRIPT code?
Please help me if we can do this with JAVA SCRIPT.


The way I did is using META REFRESH tag, with this I need create 3 html pages and doing refresh with each pages as below:
on bn1.html

<meta http-equiv="refresh" content="10;url=http://192.168.1.1/htmlpages/bn2.html">
</head>
<body scroll="no" leftmargin="0" topmargin="0" BGCOLOR="#000000">
<table valign="top" height="30" width="288" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><a href="http://www.fix8.com/: target="_blank"><img       src="http://192.168.1.1/imgs/bn.jpg" border="0" height="65" width="395" align="center"></a></td>
  </tr>
</table>



Thank in advance!
Avatar of Jaax
Jaax
Flag of India image

Using javascript:

Add onload
<body onload="callRefresh()" scroll="no" leftmargin="0" topmargin="0" BGCOLOR="#000000">

Within script tag add this function

<script>
  function callRefresh(){
      setInterval("URL", 10*1000); //Time is in milli seconds
  }
</script>
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CongUan
CongUan

ASKER

Thank Zvonko, it worked great.

Tx
You are welcome.

Do you know how to accept an Answer?