Arrrrgh! Javascript window.open () - TechRepublic
General discussion
September 17, 2002 at 05:49 AM
rosencrantz88

Arrrrgh! Javascript window.open ()

by rosencrantz88 . Updated 23 years, 9 months ago

Doing a simple project for myself at home and cannot for the life of me figure out what is wrong with my script.

I am building a simple search function in that I want to open a new window once the search parameters have been entered and a “search” formbutton is pushed…

function tuneform() {
document.Muz_form.q.select();
document.Muz_form.q.focus();
}

function isblank(s)
{
for(var i = 0; i < s.length; i++) { var c = s.charAt(i); if ((c != ' ') && (c != '\n') && (c != '\t')) return false; } return true; } function formcheck() { var d = document.Muz_form.db[1].checked; var e = document.Muz_form.q.value; if ((e == null) || (e == "") || isblank(e)) { alert("Please enter a word to lookup."); tuneform(); } else if (d == 1) { location.href = window.open("http://www.mydatabase2.com/cgi-bin/search?config=thes&words=" + escape(e)); } else { location.href = window.open("http://www.mydatabase.com/search?q=" + escape(e)); } return false; } My Dilemma is this. The window opens beautifully without issue. BUT the parent window decides it wants to display a DNS error page instead of staying unchanged. It seems like a simple script, but I must be forgetting something stupid. 🙂 The form appears as thus:

This discussion is locked

All Comments