Can't get simple code to work properly (Opening small window)

cswake

Weaksauce
Joined
Jun 17, 2002
Messages
89
Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>
<a href="http://www.msn.com" onClick="MM_openBrWindow('http://www.msn.com','','width=100,height=100')">test link</a>
</body>

How do I set it so that msn.com ONLY opens in the small window and leaves the main window where it's at? TIA.
 
i forget if you need "javascript:" in front of something for onClick/mouseOver etc, in fact, i think not

anyway, you have to add "return false;"
HTML:
<a href="http://www.msn.com" onClick="MM_openBrWindow('http://www.msn.com','','width=100,height=100'); return false;">test link</a>
it's good you're doing it that way. that makes the link usable in the event that the user has javascript disabled
 
try adding "return false;" at the end of the onClick handler. I believe that keeps the browser from continuing to deal with the <a href=... part when JS is enabled.

Code:
<a href="http://www.msn.com" onClick="MM_openBrWindow('http://www.msn.com','','width=100,height=100'); return false;">test link</a>

//edit: beaten to it. At least we've got consensus :)
 
Back
Top