I’m trying to get this code to work, it’s suppose to open the url clicked in a new window. This code works great for the “changepage” script, but can get it “openNewWindow” script to work.
You can see the script in action here at the very top of the page: http://waterwerksnw.com/php_html/home.php
Here is the code I have:
<div align="center"><a href="javascript:changepage()" "javascript:openNewWindow();"><img src="http://waterwerksnw.com/images/2011Sponsors/random/gold-0.gif" alt="Banner Advertisement" border="0" hspace="0" name="bannerad" WIDTH="468" HEIGHT="60"></a>
<script language="JavaScript"><!--
function changeimage(){
if (browsertype == "new") {
banneradcode = banneradcode + 1
if (banneradcode == "4") {
banneradcode = 0
}
imagesource = "http://waterwerksnw.com/images/2011Sponsors/random/gold-" + banneradcode + ".gif"
window.document.bannerad.src = imagesource
thetimer = setTimeout("changeimage()", 5000);
}
else if (browsertype == "old") {
}
}
function loadpage() {
browver= parseInt(navigator.appVersion);
browtype = navigator.appName;
browsertype = "old";
if (browtype == "Netscape" && !(browver < 3)) {
browsertype = "new";
}
if (browtype == "Microsoft Internet Explorer" && !(browver < 4)) {
browsertype = "new";
}
if (browsertype == "new") {
thetimer = setTimeout("changeimage()", 3000);
banneradcode = 0;
listofimages = new Array(4);
listofimages[0] = new Image(468,60)
listofimages[0].src = "http://waterwerksnw.com/images/2011Sponsors/random/gold-0.gif"
listofimages[1] = new Image(468,60)
listofimages[1].src = "http://waterwerksnw.com/images/2011Sponsors/random/gold-1.gif"
listofimages[2] = new Image(468,60)
listofimages[2].src = "http://waterwerksnw.com/images/2011Sponsors/random/gold-2.gif"
listofimages[3] = new Image(468,60)
listofimages[3].src = "http://waterwerksnw.com/images/2011Sponsors/random/gold-3.gif"
}
}
function changepage() {
if (browsertype == "new") {
if (banneradcode == 0) {
newlocation = "http://volkwearclothing.com"
}
else if (banneradcode == 1) {
newlocation = "http://podi.ca"
}
else if (banneradcode == 2) {
newlocation = "http://meistergaugefaces.com"
}
else if (banneradcode == 3) {
newlocation = "http://podi.ca"
}
location = newlocation
}
else if (browsertype == "old") {
location = "http://waterwerksnw.com/php_html/index.php"
}
}
// --></script>
<script language="JavaScript">
function openNewWindow() {
popupWin = window.open('banneradcode'),
'open_window',
'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent)
}
</script>
Any Ideas?