Results 1 to 7 of 7

Thread: Help with opening new window in script please

  1. #1
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with opening new window in script please

    Hello,

    Could someone tell me how I can open a new window in the script. I have tried putting (target="_blank") in different areas, window.open before (url), but nothing seems to work.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What script?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Java Scripts

    Where my urls are, I would like to open them in a new window.

    <style>
    <!--
    .scrollerstyle{
    font-family:webdings;backgroundink;border:1px solid pink;cursor:hand;
    }
    -->
    </style>

    <script language="javascript">

    //News Bar script- By Premshree Pillai (premshree@hotmail.com)
    //http://www.qiksearch.com/javascripts.htm
    //Enhancements by Dynamic Drive
    //Visit http://www.dynamicdrive.com for this script

    var msgs = new Array(
    "Internet Church For Christ",
    "Free Stuff Galore",
    "Tons of Free Recipes",
    "Shopping Villa - Internet's Largest Shopping Mall",
    "Fun and Games" ); // No comma after last ticker msg

    var msg_url = new Array(
    "http://churchforchrist.com",
    "http://myweb.ecomplanet.com/LIND4371/mycustompage0003.htm",
    "http://RecipeWonderland.co.nr",
    "http://ShoppingVilla.co.nr",
    "http://christianfunfair.cjb.net" ); // No comma after last ticker url

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Actually, it's the rest of the script we need.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Find this in the script:

    Code:
    function goURL(){
     location.href=msg_url[count];
    }
    Change it to this:

    Code:
    function goURL(){
     window.open(msg_url[count]);
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <style>
    <!--
    .scrollerstyle{
    font-family:webdings;backgroundink;border:1px solid pink;cursor:hand;
    }
    -->
    </style>

    <script language="javascript">

    //News Bar script- By Premshree Pillai (premshree@hotmail.com)
    //http://www.qiksearch.com/javascripts.htm
    //Enhancements by Dynamic Drive
    //Visit http://www.dynamicdrive.com for this script

    var msgs = new Array(
    "Internet Church For Christ",
    "Free Stuff Galore",
    "Tons of Free Recipes",
    "Shopping Villa - Internet's Largest Shopping Mall",
    "Fun and Games" ); // No comma after last ticker msg

    var msg_url = new Array(
    "http://churchforchrist.com",
    "http://myweb.ecomplanet.com/LIND4371/mycustompage0003.htm",
    "http://RecipeWonderland.co.nr",
    "http://ShoppingVilla.co.nr",
    "http://christianfunfair.cjb.net" ); // No comma after last ticker url

    var barwidth='350px' //Enter main bar width in px or %
    var setdelay=3000 //Enter delay between msgs, in mili-seconds
    var mouseover_color='pink' //Specify highlight color
    var mouseout_color='thistle' //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:thistle; width:'+barwidth+'; height:22px; border-width:1; border-color:thistle; 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();

    </script>

    Where the bold is I have tried, window.open(msg_url[count]);
    window.open msg_url[count]);
    window.open.href=msg_url[count]);


    but it doesn't seem to work.

  7. #7
    Join Date
    May 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so very, very much...it worked that time.

    God bless you in everything you do.
    Sarah

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
  •