PDA

View Full Version : Help with opening new window in script please



sarah
05-15-2006, 05:39 PM
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.

jscheuer1
05-15-2006, 05:53 PM
What script?

sarah
05-15-2006, 07:59 PM
Java Scripts

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

<style>
<!--
.scrollerstyle{
font-family:webdings;background:pink;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

Twey
05-15-2006, 08:56 PM
Actually, it's the rest of the script we need. :)

jscheuer1
05-15-2006, 09:28 PM
Find this in the script:


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

Change it to this:


function goURL(){
window.open(msg_url[count]);
}

sarah
05-15-2006, 11:28 PM
<style>
<!--
.scrollerstyle{
font-family:webdings;background:pink;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.

sarah
05-15-2006, 11:49 PM
Thank you so very, very much...it worked that time.

God bless you in everything you do.
Sarah