Open new html page without menubar, ....

S

Simon Lee

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;&nbsp;&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,menubars=no,toolbars=no,widt
h=500,height=550')
return true;
}
==============
but the linkage is not valid. Please give me helping hand, thanks

Regards,
Simon
 
R

RobB

Simon said:
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>
<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,menubars=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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top