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
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>
At work we have a little 'notes' section for customers, this is tied to an onclick event that sends what I assume is an ajax request to pull data on that particular customer, then loads that into a popup window.
I've been searching for a way to just stuff whats inside that notes section(which is in plain text) into a text field on the page itself, without the business of having to click and load that popup each time. I have access to install tampermonkey for edge, which could let me do this, however I'm stuck at tracing down the ajax request.
I set a breakpoint under mouse click in sources, and F9 through what seems like endless jquery, never to find what I think would be a generic call(that would work on any customer page) that I need to plug into the request for that data. Since its the same domain, I don't expect any security roadblocks.
Is there a way to do this, or am I overcomplicating it? I also looked at .load() as well, but if I can't get that generic request, its fruitless i guess