开发者

Change a default window size in browser

<form action="mail.php" method="post" target="_blank">
    <textarea name="mess" cols="50" rows="5"></textarea>
    <input name="send" type="submit" value="Send">
</form>

After pressing the button "submit", brouwser will open a new window with some text like "OK, your messagw sent to our mailbox".

Can I make this "new" window NOT fullsize of browser, but 400x300 resolution.

(also i have "mail.php" file with the next code:

<?php
if (isset ($mess))
{
$mess = substr($mess,0,10000);
if (empty($mess))
{
echo "<center><b>开发者_开发技巧Message written<p>";
echo "<a href=back-form.html>Go back and make all steps correctly</a>";
exit;
}
}
else 
{
$mess = "Unspecified";
}
$i = "не указано";
if ( $mess == $i)
{
echo "Error! The script does not have to pass parameters!";
exit;
}
$to = "vitelp@gmail.com";  /*адрес*/
$subject = "Message to your website";
$message = "Message:$mess";
mail ($to,$subject,$message) or print "Cant send your letter!";
echo "<center><b>Thanks for ypur attention.";
exit;
?> 

)


To open a new window with javascript check out window.open() method here http://www.w3schools.com/jsref/met_win_open.asp.


Try using this onload function in the new window:

<body onload="resizeTo(400,300)">

400 is the width, 300 is the height.

Note: resizeTo() isn't supported by all major browsers. More info at w3cschools.


You can set the target of your form to a new window set you opened with javascript before:

myForm.onsubmit = function(){
   var w = window.open('about:blank','Popup_Window','width:200,height:200');
   myForm.target = 'Popup_Window';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜