By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Open new html page without menubar, ....

P: n/a
Dear all,

I write a following form in the html page and link to the webpage without
scrollbar,menubar, with a fixed size as follow:
-------------------------
<form name="formsearch" method="post" action="/update/search.php"
target="new" onSubmit="return CheckForm2()"><input type="hidden"
name="PHPSESSID" value="f7092b1e7077d992e854d60c797084f9" />
<div valign=center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
<b> <font size=1 face="Verdana">Product:</font></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;
<input type="text" name="product"value="">
<input type="submit" name="Submit" value="Search">
</div>
</form>
----------------------
and the corresponding javascript
======================
function CheckForm2()
{
if(document.formsearch.product.value==""){
document.formsearch.product.focus();
alert ("Please input product name!");
return false;
}
window.open('this.href','child','scrollbars=yes,me nubars=no,toolbars=no,widt
h=500,height=550')
return true;
}
==============
but the linkage is not valid. Please give me helping hand, thanks

Regards,
Simon



Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Simon Lee wrote:
Dear all,

I write a following form in the html page and link to the webpage without scrollbar,menubar, with a fixed size as follow:
-------------------------
<form name="formsearch" method="post" action="/update/search.php"
target="new" onSubmit="return CheckForm2()"><input type="hidden"
name="PHPSESSID" value="f7092b1e7077d992e854d60c797084f9" />
<div valign=center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
<b> <font size=1 face="Verdana">Product:</font></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; <input type="text" name="product"value="">
<input type="submit" name="Submit" value="Search">
</div>
</form>
----------------------
and the corresponding javascript
======================
function CheckForm2()
{
if(document.formsearch.product.value==""){
document.formsearch.product.focus();
alert ("Please input product name!");
return false;
}
window.open('this.href','child','scrollbars=yes,me nubars=no,toolbars=no,widt h=500,height=550')
return true;
}
==============
but the linkage is not valid. Please give me helping hand, thanks

Regards,
Simon


For starters, might as well pass the form's elements[] object to your
function, as onsubmit is a property of it:

<form....onsubmit="return CheckForm2(this.elements)"><...

Then:

function CheckForm2(els)
{
if (els.product.value=="")
{
alert("Please input product name!");
if (els.product.focus)
els.product.focus();
return false;
}

You want to open a window with a blank document, whose name is the same
as the target name in the <form> tag, so - it'll be targeted there.

else
{
window.open(
'about:blank',
'newwin',
'scrollbars=yes,menubars=no,toolbars=no,width=500, height=550'
);
return true;
}
}

<form....target="newwin">

'new' is a tricky word to have around when you're scripting. Best to
avoid it.

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.