JAVASCRIPT+iframes !!!! HELLLLP

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 8th, 2007, 07:09
New Member
Join Date: Mar 2007
Location: ohio
Age: 28
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation JAVASCRIPT+iframes !!!! HELLLLP

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
Reply With Quote

  #2 (permalink)  
Old Mar 10th, 2007, 14:59
New Member
Join Date: Mar 2007
Location: Nelson, BC -- Canada
Age: 41
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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/
Reply With Quote
Reply

Tags
iframe, javascript

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 23:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43