Click to See Complete Forum and Search --> : Help with Javascipt


TBear
03-06-2003, 09:46 PM
Does anyone have any suggests for making this open in a new window?

var maxLength = 10;
siteopt = new Array;
siteopt[0] = "Genesis";
siteopt[1] = "Exodus";

var trueLength = siteopt.length;
var lst = siteopt.length;

url = new Array;
url[0] = "../genesis.html";
url[1] = "../exodus.html";

catopt = new Array;
catopt[0] = "Old Testament Books";
catopt[1] = "New Testament Books";

function changePage()
{
menuNum = document.SelectMenu.SelectPrimary.selectedIndex;
if (menuNum == null){alert("Please select a category from the menu.");return;}
else
{
i = document.SelectMenu.SelectSecondary.selectedIndex;
window.location.href = url[i];
}
}

function changeMenu()
{
siteopt.length = 0;
menuNum = document.SelectMenu.SelectPrimary.selectedIndex;
if (menuNum == null) return;

if (menuNum == 0)
{
siteopt = new Array;
siteopt[0] = new Option("Genesis");
siteopt[1] = new Option("Exodus");
url = new Array;
url[0] = "../genesis.html";
url[1] = "../exodus.html";


}

if (menuNum == 1)
{
siteopt = new Array;
siteopt[0] = new Option("Matthew");
siteopt[1] = new Option("Mark");


url = new Array;
url[0] = "../matthew.html";
url[1] = "../mark.html";

}



tot = siteopt.length;
for (i = lst; i > 0; i--)
{ document.SelectMenu.SelectSecondary.options[i] = null; }
for (i = 0; i < tot; i++)
{ document.SelectMenu.SelectSecondary.options[i] = siteopt[i]; }
document.SelectMenu.SelectSecondary.options[0].selected = true;
lst = siteopt.length;
}


with (document) {
writeln('<TABLE BORDER = 0 BGCOLOR = "#000000" CELLPADDING = 3 CELLSPACING = 0>');
writeln('<TR><TD COLSPAN = 3><FORM NAME = "SelectMenu">');
writeln('<FONT SIZE = 4 FACE = "Times" COLOR = "#FFFFFF">');
writeln('Bible Book Finder</FONT>');
writeln('</TD></TR><TR><TD ALIGN = LEFT>');
writeln('<FONT SIZE = 2 FACE = "Times" COLOR = "#FFFFFF">Testament</FONT><BR>');
writeln('<SELECT NAME="SelectPrimary" onChange="changeMenu(this.form)">');
tot = catopt.length;
for (i = 0; i < tot; i++)
writeln("<OPTION>" +catopt[i]);
writeln("</SELECT>");
writeln('</TD><TD>');
writeln('<FONT SIZE = 2 FACE = "Times" COLOR = "#FFFFFF">Book</FONT><BR>');
writeln('<SELECT NAME="SelectSecondary">');
for (i = 0; i < maxLength; i++)
writeln("<OPTION>" +siteopt[i]);
writeln("</SELECT>");
for (i = maxLength; i > trueLength; i--)
{ SelectMenu.SelectSecondary.options[i] = null; }
writeln('</TD><TD VALIGN = BOTTOM><A HREF = "javascript:changePage();">');
writeln('<IMG BORDER = 0 HEIGHT = 27 WIDTH = 70 SRC = "../jump1.gif"></A>');
writeln('</TD></TR>');
changeMenu();
writeln('</FORM>');
writeln('</TABLE>');
}

Mick

Jona
03-06-2003, 09:57 PM
Change this line: window.location.href = url[i]; to this: window.open(url[i];,"","config"); where "config" is your width, height, scrollbars (yes/no), menubar (yes/no), etc. configurations.

TBear
03-06-2003, 10:15 PM
Thank You so much!!!!!!
One more question. How do I get the address bar to comes up.

pyro
03-06-2003, 10:17 PM
location=yes

TBear
03-06-2003, 10:20 PM
What about the standard buttons. (the back, forward, home, etc.)

Mick

pyro
03-06-2003, 10:27 PM
Here are your differnt options you can use:

width=400 //the width
height=200 //the height
resizable=yes/no //is resizable?
scrollbars=yes/no //has scrollbars?
toolbar=yes/no //has toolbar (back/forward, etc)?
location=yes/no //has location bar?
directories=yes/no //has personal buttons, etc.?
status=yes/no //has status bar?
menubar=yes/no //has menu bar (File, Edit, etc)?
copyhistory=yes/no //Copy old browsers history?