Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opeing a new window using a .js file

Status
Not open for further replies.

bouchie

Programmer
Joined
Feb 17, 2006
Messages
2
Location
US
Is there any way to make this code open in a new window?

<input type="button" value="View Area Facts" lanquage="JavaScript" onclick="getDocFromSelect('html', ' '', 'width=600,height=450,location,directories,status,toolbar,resizable,menubar,scrollbars');" name="viewhtml">
 
you can 1) change the getDocFromSelect function or 2) use window.open instead of the function or 3) make the button an anchor tag and set the href attribute the the proper location.



*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Thank yo for the quick response, however, the getDocFromSelect function can't be changed. Is there a way to make this happen within the js code?


<!--


function createYear(day) {
var year = day.getYear();
if (year < 1000)
year += 1900;
return year;
}

function jump(path) {
var selected_item = document.urlpopupform.urlpopup.options[document.urlpopupform.urlpopup.selectedIndex].value;
location.href = path + selected_item;
}

function getDocFromSelect(doc_type, path, year_of_pub, window_properties, new_window) {
var list_item = document.getdocfromselectform.geolistbox.options[document.getdocfromselectform.geolistbox.selectedIndex].value;
if (list_item ==""){

window.alert("Please try again.");

return 0;

}
if (year_of_pub == "") {
doc_from_select = path + list_item + "." + doc_type;
} else {
doc_from_select = path + list_item + year_of_pub + "." + doc_type;
}
//window.alert(doc_from_select);
if(new_window) {
doc_window = window.open( doc_from_select, "newDocWindow", window_properties);
doc_window.focus();
} else {
location.href = doc_from_select;

}
}

//-->




 
yeah, do this:

Code:
getDocFromSelect('html', '[URL unfurl="true"]http://www.nhes.state.nh.us/elmi/htmlprofiles/',[/URL] '', 'width=600,height=450,location,directories,status,toolbar,resizable,menubar,scrollbars'[red], true[/red]);



*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top