Forum Moderators: open
<a href="javascript:void(0)" onClick="MM_openBrWindow('http://www.example.com/','','')" onMouseOver="MM_displayStatusMsg('http://www.example.com/');return document.MM_returnValue" onMouseOut="MM_displayStatusMsg('');return document.MM_returnValue" style="text-decoration:none">example</a>
Question:
Can I use the "onclick" command without using javascript?
Does this usage of javascript hurt my webpage?
thanks...Jim
onClick="MM_openBrWindow('http://www.example.com/','','')"
May I assume you are just simplifying the code for the sake of discussion? If not --if you really do not intend to specify any details about the window you are opening (such as size, location)-- then why are you even using javascript, and not just an ordinary HTML link?
If, on the other hand, you do specify them in your code, RonPK's solution is the way to go -- it will give exactly what you want for those who have javascript turned on, and the most important part for those who don't.
(And one minor addition/clarification to RonPK's script: since your intention is, presumably, to open a new window,remember to add the named target for those not reading javascript.)
[edited by: bruhaha at 7:01 pm (utc) on Feb. 9, 2004]
<a href="ht*p://www.example.com" target="_blank">Example</a>
(I see DrDoc's fingers move faster. And he did give you more complete code. But again, you only really need that if you plan to add other specifications about the window [height,width,location, which toolbars you wish to display or not]for your javascript-enabled users.)
[edited by: bruhaha at 7:07 pm (utc) on Feb. 9, 2004]
This doesn't mean you are not using javascript -- you are -- it's just that you do not need to invoke javascript with an explicit call because it's automatic with the event handler.
I think that point was causing some confusion earlier in this thread.