Solved

How to do refresh page with JAVA SCRIPT

Posted on 2007-04-09
6
933 Views
Last Modified: 2008-01-09
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!
0
Comment
Question by:CongUan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 10

Expert Comment

by:Jaax
ID: 18874872
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>
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 18877094
Here my example:

<html>
<head>
<title>Zvonko &#42;</title>
<base href="http://www.experts-exchange.com">
<style>
a.banner {display:none;}
</style>
<script>
var bNum = 0;
function showBanner(){
  var lnk = document.links;
  for(var b=i=0;i<lnk.length;i++){
    if(lnk[i].className=="banner"){
      lnk[i].style.display=(b==bNum)?"inline":"none";
      b++;
    }
  }
  bNum++;
  if(b==bNum) bNum = 0;
  setTimeout(showBanner, 3000);
}
</script>
<body scroll="no" leftmargin="0" topmargin="0" BGCOLOR="#000000" onLoad="showBanner()">
<table valign="top" height="30" width="288" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
<a class="banner" href="http://gmail.com/" target="_blank"><img src="/images/ta/medium/5374.png" border="0" height="65" width="395" align="center"></a>
<a class="banner" href="http://google.com/" target="_blank"><img src="/images/ta/medium/5375.png" border="0" height="65" width="395" align="center"></a>
<a class="banner" href="http://yahoo.com/" target="_blank"><img src="/images/ta/medium/5377.png" border="0" height="65" width="395" align="center"></a>
    </td>
  </tr>
</table>
</body>
</html>


0
 

Author Comment

by:CongUan
ID: 18880375
Thank Zvonko, it worked great.

Tx
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 18880513
You are welcome.

Do you know how to accept an Answer?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Echo'd values in dropdowns 6 56
Javascript: Range object 16 33
Javascript image manipulationcrop-image 7 41
How to send a javascript array via AJAX (jquery)? 3 41
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question