Results 1 to 6 of 6
  1. #1
    nd4rk is offline Member
    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    Exclamation Please I need help, urgent

    Hi all,
    I've got a problem, a friend helped me code this:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>rotate</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript">
    var pictureArchive= new Array(4);
    pictureArchive[0]='1.jpg';
    pictureArchive[1]='2.jpg';
    pictureArchive[2]='3.jpg';
    pictureArchive[3]='4.jpg';

    window.onload=function() {
    var o=document.createElement('img');
    o.setAttribute('id', 'image');
    o.setAttribute('src', pictureArchive[0]);
    alert (pictureArchive[0].src);
    o.setAttribute('alt', '');
    document.body.appendChild(o);
    rotate(pictureArchive.length);
    }

    function rotate(idx) {
    if(idx>=pictureArchive.length) {
    idx=0;
    }
    document.getElementById('image').src=pictureArchiv e[idx++];
    //document.write("<img src='" + pictureArchive[idx++] +"'/>");
    timerID=setTimeout('rotate('+idx+')', 4000);
    }
    </script>

    <style type="text/css">
    </style>

    </head>
    <body>

    </body>
    </html>
    now the images rotate perfect so i have no problem with that, now instead of calling up the images from archive I want to be able to call them up using a javascript. something like the one below:
    <script type="text/javascript" src="http://g.adspeed.net/ad.php?do=js&zid=29681&wd=-1&ht=-1&target=_top"></script>
    now i have 5 sets of code just like this one, however i do not know how to call them up.
    could someone please assist me I've been tryin to figure this out for days now...

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Ask your friend where there is javascript forum,
    this is a java forum.

  3. #3
    nd4rk is offline Member
    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    Default

    ooops.....sry

  4. #4
    bnson is offline Artemis
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    Hello,
    My English is not good, I think you want call code javascript and not have insert it's to html file.
    The first you created file "*.js"(ex: rotate_img.js) and copy script of you to it's

    Java Code:
    var pictureArchive= ['1.png','2.png','3.png','4.png'];
     
    window.onload=function() {
     var o=document.createElement('img');
     o.setAttribute('id', 'image');
     o.setAttribute('src', pictureArchive[0]);
     o.setAttribute('alt', '');
     document.body.appendChild(o);
     rotate(pictureArchive.length);
    }
     
    function rotate(idx) {
     if(idx>=pictureArchive.length) {
      idx=0;
     }
     document.getElementById('image').src=pictureArchive[idx++];
     timerID=setTimeout('rotate('+idx+')', 40);
    }
    Continue you insert the code following after <meta> tag:
    Java Code:
    <script type="text/javascript" src="rotate_img.js"></script>
    Now you have run html file.
    //--------------------------------------------
    You can downlod expamle:JavaScript_Rotate_Image.rar
    Last edited by bnson; 07-18-2011 at 06:59 PM.

  5. #5
    nd4rk is offline Member
    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    Default

    hi,
    sorry I have been unclear of what I need help with,
    <script type="text/javascript" src="http://g.adspeed.net/ad.php?do=js&zid=29681&wd=-1&ht=-1&target=_top"></script>
    is a javascript code that calls up a banner/image with a tracker from a 3rd party entity, now I wish to replace the images that I have in archive with the javascript code displayed above.
    hope this is more clear on what i need help with

  6. #6
    bnson is offline Artemis
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    Hi, nd4rk


    I think you want insert your JavaScript to javascript of "g.adspeed.net, and you want change banner "AS#404: NO AD FOUND IN ROTATION" to your image.
    what you want?

    if this is what you want then implementation is required you have permission edit or change content of script,
    else can not implement of required.

    Java Code:
    <script type="text/javascript" src="http://g.adspeed.net/ad.php?do=js&zid=29681&wd=-1&ht=-1&target=_top"></script>
    The code provide form a 3rd parte entity(http://g.adspeed.net/), I'm think you can't edit its. The link "http://g.adspeed.net/ad.php?do=js&zid=29681&wd=-1&ht=-1&target=_top" provide a code javascript and compiled to file *.js, we only call its.

    //------------------------------------------
    I'm propose a solution, you have used both file *.js

    Java Code:
    <script type="text/javascript" src="rotate_img.js"></script>
    <script type="text/javascript" src="http://g.adspeed.net/ad.php?do=js&zid=29681&wd=-1&ht=-1&target=_top"></script>
    Though not satisfactory, but I'm think look & feel of the link a better.

    Have nice day,....

Similar Threads

  1. [URGENT]SHA Encryption System...need urgent helps
    By java_idiot in forum New To Java
    Replies: 6
    Last Post: 05-02-2010, 10:04 AM
  2. Urgent need
    By anurag_1226 in forum AWT / Swing
    Replies: 2
    Last Post: 04-01-2010, 07:20 AM
  3. Urgent Help!!
    By Winniee in forum New To Java
    Replies: 5
    Last Post: 02-17-2009, 03:32 AM
  4. Help. It's urgent
    By monir6464 in forum AWT / Swing
    Replies: 2
    Last Post: 08-24-2008, 05:57 PM

Posting Permissions

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