Newbie script query

Discussion in 'Javascript' started by CeNo, Jan 29, 2004.

  1. CeNo

    CeNo Guest

    Hi all,

    Newbie question for you all....

    I downloaded a script for use with my own personal site, which works very
    well. I just wish to make a modificatiopn if possible.

    Basically it is a news ticker, and when a user clicks on a news item they
    are taken to that URL, but in a blank page. I wish for the new page to be
    just a pop up window, with a few lines of text within, that the user can
    then close and return to the page within the site....

    I have enclosed the script for your perusal. - Note...the creaters email
    address no longer exists, so I could not contact him for help!!

    Any help would be greatly appreciated!

    Many thanx,

    Sean.


    //News Bar script- By Premshree Pillai ()

    var msgs = new Array(
    "Borough beat League leaders 2-1!",
    "NEXT MATCH: Ewell Village on 1st Feb 04.",
    "Royal Admiral in Quarter Final of League Cup on 15th Feb 04.",
    "LAST RESULT: Royal Borough 2-1 AFC Ewell Reserves.",
    "League success still possible - Manager Paul Burnham!" ); // No comma
    after last ticker msg

    var msg_url = new Array(
    "http://www.royalboroughfc.myby.co.uk/News1.htm",
    "http://www.javascriptkit.com",
    "http://freewarejava.com",
    "http://www.wired.com",
    "http://www.qiksearch.com" ); // No comma after last ticker url

    var barwidth='468px' //Enter main bar width in px or %
    var setdelay=3000 //Enter delay between msgs, in mili-seconds
    var mouseover_color='#FFFF00' //Specify highlight color
    var mouseout_color='#FFFFFF' //Specify default color
    /////////////////////////////////////////////////////////////////////

    var count=0;
    var ns6=document.getElementById&&!document.all
    var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

    if (ie4||ns6){
    document.write('<form name="news_bar"><input type="button" value="3"
    onclick="moveit(0)" class="scrollerstyle" style="width:22px; height:22px;
    border-right-width:0px;" name="prev" title="Previous News"><input
    type="button" name="news_bar_but" onclick="goURL();"
    style="color:#000000;background:#FFFFFF; width:'+barwidth+'; height:22px;
    border-width:1; border-color:#000000; cursor:hand"
    onmouseover="this.style.background=mouseover_color"
    onmouseout="this.style.background=mouseout_color"><input type="button"
    value="4" onclick="moveit(1)" class="scrollerstyle" style="width:22px;
    height:22px; border-left-width:0px;" name="next" title="Next
    News"></form>');
    }
    else{
    document.write('<form name="news_bar"><input type="button" value="Previous"
    onclick="moveit(0)">')
    if (navigator.userAgent.indexOf("Opera")!=-1)
    document.write('<input type="button" name="news_bar_but" onclick="goURL();"
    style="width:'+barwidth+'" border="0">')
    else
    document.write('<input type="button" name="news_bar_but" onclick="goURL();"
    width="'+barwidth+'" border="0">')
    document.write('<input type="button" value="Next"
    onclick="moveit(1)"></form>')
    }

    function init_news_bar(){
    document.news_bar.news_bar_but.value=msgs[count];
    }
    //moveit function by Dynamicdrive.com
    function moveit(how){
    if (how==1){ //cycle foward
    if (count<msgs.length-1)
    count++
    else
    count=0
    }
    else{ //cycle backward
    if (count==0)
    count=msgs.length-1
    else
    count--
    }
    document.news_bar.news_bar_but.value=msgs[count];
    }

    setInterval("moveit(1)",setdelay)

    function goURL(){
    location.href=msg_url[count];
    }

    init_news_bar();
    CeNo, Jan 29, 2004
    #1
    1. Advertising

  2. CeNo

    kaeli Guest

    kaeli, Jan 29, 2004
    #2
    1. Advertising

  3. CeNo

    CeNo Guest

    Kaeli,

    Many thanx for that, but where would I put it?

    Sorry, complete newbie at this!

    Sean.
    "kaeli" <> wrote in message
    news:...
    > In article <JmbSb.4928$>,
    > enlightened us with...
    > >
    > > function goURL(){
    > > location.href=msg_url[count];
    > > }
    > >

    >
    > a guess...
    >
    > function goURL()
    > {
    > window.open(msg_url[count],"","width=200, height=200");
    > }
    >
    > --
    > --
    > ~kaeli~
    > Local Area Network in Australia:... the LAN down under.
    > http://www.ipwebdesign.net/wildAtHeart
    > http://www.ipwebdesign.net/kaelisSpace
    >
    CeNo, Jan 29, 2004
    #3
  4. CeNo

    kaeli Guest

    kaeli, Jan 29, 2004
    #4
  5. CeNo

    CeNo Guest

    Kaeli,


    Many, many htx for your help. It worked a treat!!!!

    Sean.


    "kaeli" <> wrote in message
    news:...
    > In article <hQdSb.6$>,
    > enlightened us with...
    > > Kaeli,
    > >
    > > Many thanx for that, but where would I put it?
    > >

    >
    > Replace the function I quoted with the function I wrote.
    >
    > --
    > --
    > ~kaeli~
    > She was engaged to a boyfriend with a wooden leg but broke
    > it off.
    > http://www.ipwebdesign.net/wildAtHeart
    > http://www.ipwebdesign.net/kaelisSpace
    >
    CeNo, Jan 29, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Learner
    Replies:
    1
    Views:
    984
    Marina Levit [MVP]
    Jan 30, 2006
  2. Anonymous
    Replies:
    0
    Views:
    1,460
    Anonymous
    Oct 13, 2005
  3. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    788
    David Gordon
    May 18, 2005
  4. Rajat
    Replies:
    3
    Views:
    693
    Jorgen Grahn
    Jan 8, 2010
  5. VYAS ASHISH M-NTB837
    Replies:
    2
    Views:
    552
    Jan Kaliszewski
    Jan 7, 2010
Loading...

Share This Page