SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open new window to my script. I'm stumped.

    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:
    Code:
    						<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?

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Does this open a new page?

    Code:
    <a href="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>
    (in other words, does it work when it is by itself?)


    Off Topic:

    As a side note, I would not be able to navigate your web page. It would be completely broken and confusing for me.


    Oh, and, welcome to SitePoint forums!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •