...

View Full Version : opening links from random image script in resized window???



gticlutchburn
03-06-2005, 03:35 AM
I have been trying to get this script to let me open the linked page in a new window that I can resize with no toolbars or scrollbars. This is the code I have, any help would be appreciated...



<script language="JavaScript">
<!--
/*
Random Image Link Script
By Website Abstraction (http://www.wsabstract.com)
and Java-scripts.net (http://www.java-scripts.net)
*/

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="splash/patboy.jpg"
myimages[2]="splash/kevinboy.jpg"
myimages[3]="splash/keithboy.jpg"
myimages[4]="splash/chrisboy.jpg"
myimages[5]="splash/danboy.jpg"

//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="index2.html"
imagelinks[2]="index2.html"
imagelinks[3]="index2.html"
imagelinks[4]="index2.html"
imagelinks[5]="index2.html"

var ry=Math.floor(Math.random()*myimages.length)

if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+' target="_blank"><img src="'+myimages[ry]+'" border=0></a>')
}

random_imglink()
//-->
</script>

vwphillips
03-06-2005, 11:37 AM
You could combine the random image with

http://www.vicsjavascripts.org.uk/PopUpGenerator/PopUpGenerator.htm


say if you need more help

gticlutchburn
03-07-2005, 01:40 AM
more help would be excellent. my problem is that I can get it to open in a new window (by using HTML to target it to _blank). The problem is you can't define the parameters of the new window in HTML, and I dont know how to work the javascript open window code into the random image script. So, what I need is someone who could help me throw a java open window script into the random image code. Thank you guys in advance.

glenngv
03-07-2005, 02:20 AM
...
document.write('<a href='+'"'+imagelinks[ry]+'"'+' target="mypopup" onclick="return doOpen(this.href, this.target, 600, 500)"><img src="'+myimages[ry]+'" border=0></a>');
...

function doOpen(url, target, w, h){
var w = window.open(url, target, "width="+w+", height="+h+", resizable=1, location=0, scrollbars=0");
w.focus();
return false;
}

gticlutchburn
03-08-2005, 01:34 AM
thank you so very much, works like a charm



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum