Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having some trouble with JS pop-up

Status
Not open for further replies.

Blueie

Technical User
May 12, 2012
72
GB
Hello

I have a link on my Home page that is supposed to open a pop-up window (a HTML page smaller than the Homepage and you should see the Homepage behind the pop-up).

When I click on the link on my Home page, I do get taken to the HTML pop-up page but the dimensions of that page are ignored. This is what I have in my Home page:

Code:
</script>

<script>
function myFunction() {
    window.open("Domestic_Violence.asp", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");
}
window.onload = function() {
  document.getElementById('myLink').onclick = myFunction();
}
</script>

</head>

And the link looks like this:

HTML:
<li><a href="Domestic_Violence.asp" id="myLink" target="_blank">Domestic Violence</a></li>

These dimensions - top=500, left=500, width=400, height=400 - referred to above, are ignored: I can see a full-screen page.

I have also placed the JS code in its own external file and references it in my Home page <head> tags as follows:

Code:
<script src="myPopup.js"></script>

but it makes no difference.

Any help would be appreciated.

Thanks.
 
browser??

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Oh and target="_blank" opens a normal sized window.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top