Results 1 to 4 of 4

Thread: banner/image randomizer that then opens a resized html window on click (size=290x164)

  1. #1
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default banner/image randomizer that then opens a resized html window on click (size=290x164)

    I would like to combine the two scripts to work together. Any help would be greatly appreciated.



    I need an banner/image randomizer that then opens a resized html window on click (size=290x164) with no tool bars & no scroll



    Sample html documents

    -----------------------------------------------------------------------------



    <html>
    <head>
    <title>Untitled Document</title>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script type="text/JavaScript" src="js/rotation.js"></script><!-- Popup window -->
    <script type="text/JavaScript" src="js/popup.js"></script><!-- Popup window -->

    </head>
    <body onload="window.name = 'pbmain';">

    <a href="folder/document.html" onclick="NewWindow(this.href,'coupon','300','270','no','center');return false" onfocus="this.blur()"><img src="images/folder/image_name.jpg" width="290" height="164" border="0"></a>

    </body>
    </html>

    -----------------------------------------------------------------------------


    <html>
    <head>
    <title>Untitled Document</title>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script type="text/JavaScript" src="js/rotation.js"></script><!-- Popup window -->
    <script type="text/JavaScript" src="js/popup.js"></script><!-- Popup window -->

    </head>

    <body onload="window.name = 'pbmain';">

    <script type="text/JavaScript" src="folder/rotation.js"></script>

    </body>
    </html>


    -----------------------------------------------------------------------------
    Here is the rotation script


    <!-- Begin
    rnd.today=new Date();
    rnd.seed=rnd.today.getTime();

    function rnd() {
    rnd.seed = (rnd.seed*9301+49297) % 233280;
    return rnd.seed/(233280.0);
    };

    function rand(number) {
    var result = Math.ceil(rnd()*number);
    if (!result)result++;
    return result
    };
    var ad_cnt4 = 8;
    var ad4 = rand(ad_cnt4);
    var link4;
    var adBanner4;
    var width4
    var height4
    if (ad4==1) {
    link4="http://www.url.com/folder/document.html";
    adBanner4="http://www.url.com /folder/image_name1.jpg";
    width4="290";
    height4="164";
    alt4="name_title";
    }
    if (ad4==2) {
    link4="http://www.url.com/folder/document.html";
    adBanner4="http://www.url.com /folder/image_name2.jpg";
    width4="290";
    height4="164";
    alt4="name_title";
    }
    if (ad4==3) {
    link4="http://www.url.com/folder/document.html";
    adBanner4="http://www.url.com /folder/image_name3.jpg";
    width4="290";
    height4="164";
    alt4="name_title";
    }
    if (ad4==4) {
    link4="http://www.url.com/folder/document.html";
    adBanner4="http://www.url.com /folder/image_name4.jpg";
    width4="290";
    height4="164";
    alt4="name_title";
    }
    document.write('<center><a href="' + link4 + '" target="_blank">');
    document.write('<img src="' + adBanner4 + '" width=' + width4 + ' height=' + height4 + ' border=0 alt="' + alt4 + ' "></a>');
    document.write('</center>');
    // End -->


    -----------------------------------------------------------------------------
    Popup window resize script


    <!--
    /****************************************************
    Author: Eric King
    Url: http://redrival.com/eak/index.shtml
    This script is free to use as long as this info is left in
    Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
    ****************************************************/
    var win=null;
    function NewWindow(mypage,myname,w,h,scroll,pos){
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
    win=window.open(mypage,myname,settings);}
    // -->


    -----------------------------------------------------------------------------

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    Do you have a guess at how to do this? (Hint: The last part of that rotation script looks kinda familiar...)

  3. #3
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Are you saying that you CAN'T combine the two scripts?! I can't understand very well... Please be more specific...

    -magicyte

    P.S. ...

    P.P.S. ...

    P.P.P.S. lol (el-oh-el) || (laugh out loud)

  4. #4
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    No; I'm saying that I don't want to simply give the answer to someone who hasn't tried to get it on their own.

    The first script contains the link you want, and the rotation script also has a link. You should take what you like about each and put the combination in the rotation script.

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
  •