mylink (the button's this) isn't a string, so you try to open mylink.href:
if (typeof(mylink) == 'string')
href = mylink;
else
href = mylink.href;
But buttons don't have href properties, so it's as if you wrote:
window.open(undefined, 'about', 'width=400,height=200,scrollbars=yes');
which opens a blank page, as expected. If you want to open the same page as the link, use:
onclick="popup('newpopup.html', 'about');"
Answer from Paul Roub on Stack Overflowmylink (the button's this) isn't a string, so you try to open mylink.href:
if (typeof(mylink) == 'string')
href = mylink;
else
href = mylink.href;
But buttons don't have href properties, so it's as if you wrote:
window.open(undefined, 'about', 'width=400,height=200,scrollbars=yes');
which opens a blank page, as expected. If you want to open the same page as the link, use:
onclick="popup('newpopup.html', 'about');"
Try this simple piece of code:
<script>
function fullwindowpopup(){
window.open("newpopup.html","bfs","fullscreen,scrollbars")
}
</script>
<center>
<form>
<input type="button" onClick="fullwindowpopup()" value="CLICK HERE">
</form>
</center>
Videos
Is Popupsmart Compatible with CMS to Display Popup Campaign?
How Can I Ensure a Seamless UX with Popups?
Can I Track the Performance of My Popups?
you have to call javascript on onClientClick
<asp:Button ID="button1" runat="server" OnClientClick="window.open('BooksAuthor.aspx');" Text="Display" /><br /><br />
Or
<asp:Button ID="button1" runat="server" OnClientClick="openWindow();" Text="Display" /><br /><br />
<script type="text/javascript">
function openWindow() {
window.open("BooksAuthor.aspx", "status=1,width=600,height=300");
}
To open custom sized window the proper syntax is
window.open(URL,name,specs,replace)
EX:-window.open("BooksAuthor.aspx", "MsgWindow", "width=600,height=300");
Just use window.open:
var referenceToNewWindow = window.open(url, name, features);
function popup(mylink, windowname, w, h){
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, "width="+w+",height="+h+",scrollbars=yes,toolbar=no" );
return false;
}
<a href="http://www.example.com" onClick="return popup(this, 'Title', '400', '500')">Link</a>
why you not try:
<form><input class="btnstylega" onclick="window.open('https://google.com','mywindow',
'menubar=1,resizable=1,width=500,height=500')"
type="button" value="Neue Versicherung hinzufügen" /></form>
Use _blank with the target attribute; this will open a new tab:
<form>
<input class="btnstylega" type="button" value="Neue Versicherung hinzufügen" target="_blank" />
</form>
Or if you want to open a new window, use the onClick attribute:
<button class="button" onClick="window.open('http://www.example.com');">
<span class="icon">Open</span>
</button>
Here, do NOT forget the quotation marks around the "window.open('http://www.example.com');".