PDA

View Full Version : Popup Window comes out as whole window



arzoo
05-11-2006, 10:39 AM
I'm trying to send submitted information that has been validated via javascript onto a popup window. However the popup becomes a whole window.

I'm new to javascript and still learning the ropes. Please provide any assistance and feel free to provide advice and modifications to the code.

Thanks.
---------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script type="text/javascript" language="JavaScript">
<!--
function checkContents(theForm)
{
if (theForm.name.value == "")
{
alert("Please enter a name.");
}
else if (theForm.weight.value == "")
{
alert("Please assign a weight.");
}
else
{
theForm.submit();
}
}

function popWindow(wName){
features =

'width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,r

esizable=no';
pop = window.open('',wName,features);
if(pop.focus){ pop.focus(); }
return true;
}
-->
</script>
</head>

<body>
<form name="edititem" action="popup2.php" method="post" target="Details" onSubmit="return

popWindow(this.target)">
<input type="hidden" name ="weight" value="172">
<input type="hidden" name="name" value="John">
<!--<input type="submit" value="John">-->

<input type="button" value="Edit Item" onClick="checkContents(edititem)">
</form>

</body>
</html>

Twey
05-11-2006, 10:58 AM
However the popup becomes a whole window.As opposed to a healthy and nutritious dinner?

arzoo
05-11-2006, 01:39 PM
I was hoping that the popup would be just a popup window with the settings in the javascript function, ie. a smaller sized window without the menu, etc.

what's happening is that the new window covers the old one entirely. i was hoping for a smaller window where the user can edit the data and upon submission, the data will update the info on the main(original page) and reload the info with what was edited.

thanks.

Twey
05-11-2006, 02:44 PM
Well, you haven't escaped the linebreaks in the features variable. Try removing them.
Also, all variables should be declared using the "var" keyword, to avoid them being unnecessarily global.