473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

refresh just the iframe every 5 seconds

I'm new to Java so I just downloaded this code from dynamicdrive.com and hope to make it work.
I want it to refresh every 5 seconds. Any ideas?

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.2">
  2.  
  3. //Random iframe content- © Dynamic Drive (www.dynamicdrive.com)
  4. //For full source code, and Terms Of use, visit http://dynamicdrive.com
  5. //This credit MUST stay intact for use
  6.  
  7. var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
  8. var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
  9.  
  10. //Specify IFRAME display attributes
  11. var iframeprops='width=364 height=241 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" allowtransparency="true"'
  12.  
  13. //Specify random URLs to display inside iframe
  14. var randomcontent=new Array()
  15. randomcontent[0]="http://fake.com/widgets/fake1"
  16. randomcontent[1]="http://fake.com/widgets/fake2"
  17. randomcontent[2]="http://fake.com/widgets/fake3"
  18. randomcontent[3]="http://fake.com/widgets/fake4"
  19. randomcontent[4]="http://fake.com/widgets/fake5"
  20. randomcontent[5]="http://fake.com/widgets/fake6"
  21. randomcontent[6]="http://fake.com/widgets/fake7"
  22. randomcontent[7]="http://fake.com/widgets/fake8"
  23. randomcontent[8]="http://fake.com/widgets/fake9"
  24.  
  25. //No need to edit after here
  26. if (ie||dom)
  27. document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
  28.  
  29. function random_iframe(){
  30. if (ie||dom){
  31. var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
  32. iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
  33. }
  34. }
  35. window.onload=random_iframe
  36. </script>
  37.  
Nov 18 '10 #1
3 3274
I'm using HTML and Javascript to develop a home page and a search page. I'm passing values in the hyperlinks that connect the search page to the home page. I want to be able to hide/write text boxes on the search page depending on what link is clicked. (If they clicked the Region search link in the home page only the region text box is displayed on the search page, student search link only displays the student search box etc.) I'm reasonably sure this can be done but I guess something is missing because nothing shows up in my search page even though I have the value passed in the hyperlink displayed.

Home Page:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <BODY>                                     
  3. <FORM NAME="HOMEPAGE" ID="HOMEPAGE" METHOD="POST"> 
  4. <TABLE>
  5. SEARCH FOR A CIR:</B> <BR />                             
  6. <A HREF="HTTPS://DEVL.DSS.STATE.MO.US/YCRS?TYPE=REGION"> 
  7. <LI> SEARCH BY REGION </LI>                              
  8. <A HREF="HTTPS://DEVL.DSS.STATE.MO.US/YCRS?TYPE=SUBMIT"> 
  9. <LI> SEARCH BY SUBMITTER</LI>                            
  10. <A HREF="HTTPS://DEVL.DSS.STATE.MO.US/YCRS?TYPE=STUDENT">
  11. <LI> SEARCH BY STUDENT ID</LI>                           
  12. <A HREF="HTTPS://DEVL.DSS.STATE.MO.US/YCRS?TYPE=DATE">   
  13. <LI> SEARCH BY DATE</LI> <BR/>   
  14. </TABLE>
  15. </BODY>
  16.  
  17.  
SEARCH PAGE:

Expand|Select|Wrap|Line Numbers
  1. <HEAD>
  2. function getparams(){                                                   
  3.  var idx=document.URL.indexOf('?');                                     
  4.  var params = new Array();                                              
  5.    if (idx != -1) {                                                     
  6. var pairs=document.URL.substring(idx+1, document.URL.length).split('&');
  7.     for (var i=0; i<pairs.length; i++)  {                               
  8.     nameVal = pairs[i].split('=');                                      
  9.     params[nameVal[0]] = nameVal[1];                                    
  10.  }
  11. }                                                            return params;                                                     }                                                            params = getparams();                                                
  12. </HEAD>
  13.  
  14. <BODY>
  15. <form name="searchfunction" id="searchfunction" method="get">
  16.  
  17. <input type=hidden name="srchTYPE" id="srchTYPE">               
  18.  
  19. <script type="text/javascript">                                  
  20. var search = searchfunction.srchTYPE.value                       
  21. switch(search)                                                   
  22. {                                                          Case REGION:                                                   
  23. document.write('<tableborder="0"width="100%">');               
  24. document.write('<tr>');                                          
  25. document.write
  26. ('<td width="10%"><strong>REGION:</strong><br />');
  27. ETC ETC.
  28. break;
  29.  
  30.  
  31.  case SUBMIT:                                                         
  32. document.write('<table border="0" width="100%">');                     
  33. document.write('<tr>');                                                
  34. document.write('<td width="10%"><strong>SUBMITTER ID:</strong><br />');
  35. ETC. ETC.
  36. break;
  37. }
  38. </script>
  39. </form>
  40.  
  41. <script language="JavaScript">                     
  42.     stype = unescape(params["TYPE"]);              
  43.     document.searchfunction.srchTYPE.value = stype;
  44. </script>    
  45. </body>
  46.  
  47.  
Nov 19 '10 #2
Dheeraj Joshi
1,123 Expert 1GB
Probably you should post this is Java Script forum.
Java != Java Script.

Regards
Dheeraj Joshi
Nov 22 '10 #3
If you want to refresh IFrame after certain time, why dont you use <meta refresh> in the file which is url of iframe. Syntax of <meta refresh> you can find in the google.
Nov 24 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Conax | last post by:
Hi there, My boss is hoping that I can come up with a page that displays some information. The information will always be displayed on specific part of the page, with auto refresh. But he...
2
by: Guy | last post by:
JavaScript can get time, can it get milliseconds, or actually just tenths of seconds? Thanks for all Guy
3
by: Laszlo Szijarto | last post by:
I want to refresh the text of a label box, say, every second. Is there a way to maintain some kind of persistent connection to the server and the codebehind in order to pull this off or am I...
2
by: J-T | last post by:
Hello, I have an iframe which its scr is set to show a url (am image) .I am put this iframe on a user control and I am loading that user control dynamically to my Default.aspx.Now I need to...
3
by: Kevin | last post by:
Hi guys, I want to refresh some pages every 2 seconds. however, these html pages are not in my site, they could be any pages from yahoo.com or msn.com. I can create a page, which redirect to...
1
by: jonathan184 | last post by:
how to let ajax refresh a page every few secs Hi I got a php page that did that is being fed data that changes every few secs, i need some help in doing some code in letting the page aut refresh...
16
by: Hemavathi | last post by:
can someone help me with code to refresh my PHP pages every ten seconds?
3
by: tvnaidu | last post by:
How to auto refresh page for every 3 minutes by passing command part of URL?. I need to refresh one page automatically by passing that refresh command part of url, for example if I want to refresh...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.