HighDots Forums  

Open new html page without menubar, ....

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Open new html page without menubar, .... in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon Lee
 
Posts: n/a

Default Open new html page without menubar, .... - 02-20-2005 , 07:48 PM






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










Reply With Quote
  #2  
Old   
RobB
 
Posts: n/a

Default Re: Open new html page without menubar, .... - 02-20-2005 , 11:16 PM






Simon Lee wrote:
Quote:
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,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.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.