This is a discussion on "JAVASCRIPT+iframes !!!! HELLLLP" within the JavaScript Forum section. This forum, and the thread "JAVASCRIPT+iframes !!!! HELLLLP are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
JAVASCRIPT+iframes !!!! HELLLLP
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hi
i'm trying to make a script that opens a random link from the page contained in an iframe after 5 seconds ....a sort of random redirection that's what i done : <head></head><body> <script> <!-- function random_all(){ var myrandom=Math.round(Math.random()*(document.links. length-1)) window.location=document.links[myrandom].href } //--> </script> <a href="javascript:random_all()">Random Link</a> <iframe id="frame" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" width="100%" height="100%" src="http://www.yahoo.com"> </iframe> </body> Thanks for your help |
|
|
|
|||
|
Re: JAVASCRIPT+iframes !!!! HELLLLP
Hello AMDERBO,
You're missing quite a bit in this script. The links on your page that you are trying to display have to be stuffed into an array. var links = new Array () After page has loaded you need a setTimeout function to call the display link function after 5 seconds. setTimeout(display_link(), 5000); You are incorrectly accessing the frame object. Use the following code after you customize it for your application. function display_link() { document.getElementById('frame').src = link[myrandom]; } Hope this gets you started in the right direction. Todd DeVries (Gannyaa) http://iGannyaa.bebo.com/ |
![]() |
| Tags |
| iframe, javascript |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Iframes | angel1dot0 | Webforumz Cafe | 5 | Dec 28th, 2006 18:19 |
| iframes | joshcxa | Web Page Design | 2 | Jun 8th, 2006 03:00 |
| Frames and IFrames | Jaken Veina | Web Page Design | 10 | Mar 23rd, 2006 17:00 |
| iframes | daygon | Web Page Design | 1 | Feb 22nd, 2006 19:06 |
| iframes - Centering | JamieH | Web Page Design | 1 | Jan 11th, 2005 02:00 |