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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript problem

Status
Not open for further replies.

kferri

Programmer
Joined
Jul 11, 2006
Messages
8
Location
US
I'm trying to remove the toolbar and scrollbar and set the size of my popup window using javascript. I have a image that has links on it and when you click on a link it pops up a new window.

Here is my code:
<script language="JavaScript"><!--
function P(url,h,w) { // (url,height,width)
var p = "height=100" + h + ",width=100" + w + ",scrollbars=no";
window.open(url,"",p);
} // -->
</script>



Html Code:
<map name="FPMap0">
<area href="javascript:P('Hole1.html',100,500)" shape="circle" coords="33, 173, 17" target="_blank">
</map>

It's not working I just go to a page cannot be displayed page. Does anyone see what I did wrong?

Thanks in advance,
Kelly
 
[1] Your function may have a typo. The effective size may cause problem.
>var p = "height=[highlight]100[/highlight]" + h + ",width=[highlight]100[/highlight]" + w + ",scrollbars=no";
[tt]var p = "height=" + h + ",width=" + w + ",scrollbars=no";[/tt]

[2] Take out the target="_blank". The window.open will take care of that purpose. With that attribute, href will mis-behave.
><area href="javascript:P('Hole1.html',100,500)" shape="circle" coords="33, 173, 17" [highlight]target="_blank"[/highlight]>
[tt]<area href="javascript:P('Hole1.html',100,500)" shape="circle" coords="33, 173, 17">[/tt]

[3] Tagging is on the loose side... it's fine, but just note that do not go to tightening dtd spec.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top