Hi,

function myWindows(link) {
if (!window.focus) return true;
var href;
if (typeof(link) == 'string') href=link;
else href=link.href;
window.open(href, 'width=5000,height=500,scrollbars=yes');
return false;
}
}

<a href=2bla.php" onClick="return myWindows(this)">Open</a> Above code opens new plain windows. How can i do same thing with a submit button? It will be plain as it is made with a link.

Thanks

Recommended Answers

All 5 Replies

I use submit button send data as well.

A basic example on how to open newWindow using submit button! Enjoy coding...

<htm>
<head>
<title>SomeTitle</title>
<script type="text/javascript">

function myWindows( form, link )
{ window.open( link, target='_blank', 'toolbar = yes, scrollbars = yes, location = yes, width = 5000, height = 500' ); } 
</script>
</head>
<body>
<form name="form1" onsubmit="myWindows(this.form, '2bla.php' );">
<input type="submit" name="sbmt" value="Surf!" />
</form>

</body>

</html>

Hi essintial,

It doesn't send the POST data which is in form.

Can i add 'toolbar = yes, scrollbars = yes, location = yes, width = 500, height = 500' in <BODY> tag. Whenever i open that page properties of that page will be default.

Thanks

Here you go! Hope you had a great time today!

<htm>
<head>
<title>SomeTitle</title>
<script type="text/javascript">
window.onload = function() { 
window.open( '', target="_parent", 'toolbar = no, scrollbars = no, location = no, height = 500, width = 3000, resizable = no, status = no' );
} 
</script>
</head>
<body>
<form name="form1" action="2bla.php" method="post">
<input type="submit" name="sbmt" value="Submit" />
</form><br />
</body>

</html>

Heres another way to do it!

The default value is true.

<script type="text/javascript">
window.onload = function()
{ var myWindow = window.open('');
myWindow.personalbar.visible = false; 
myWindow.statusbar.visible = false;
myWindow.scrollbars.visible = false;
myWindow.outerheight = '500';
myWindow.outerwidth = '5000';
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.