...

View Full Version : onClick Navig 4



craig
08-04-2002, 04:10 AM
As usual Navigator 4 !

It will work outside the <div> tag in Netscape but not when the img is positioned.

Trying to incorporate onClick inside a <div>. tag.
Works in explorer.Not in Netscape 4

Maybe start a new extension called .Not for all this stuff!

This the code:

<HTML>
<HEAD>
<TITLE></TITLE>
<META name="description" content="">
<META name="keywords" content="">
<META name="generator" content="CuteHTML">
</HEAD>
<LINK REL="stylesheet" HREF="http://www.proamrodeo.com/scriptlib/overlib.css" TYPE="text/css">

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">


<DIV ID="overDiv" STYLE="position:absolute; visibility:hide; z-index:2;"></DIV>


<SCRIPT LANGUAGE="JavaScript" SRC="http://www.proamrodeo.com/scriptlib/overlib.js"></SCRIPT>


<A HREF="javascript:void(0);" onfocus="this.blur()" onClick="src('Text','J.W. Kinder!'); return false;" onMouseOver="drc('Information and Links Available here.','Click to Stick A Description and Links.'); return true;" onMouseOut="nd(); return true;"><img src="http://www.proamrodeo.com/jpg/jwcard.jpg" border="0"></img></A>

The Above set up works but the below won't support onClick I think?

Should be able to cut and paste into editor to display in browser.
(Sorry in advance if I have insulted your intelligence)

<DIV STYLE="position:absolute; top:240px; left:140px; width:165px; border-width:0; visibility: visible; z-index:1">
<a href="javascript:void(0);" onfocus="this.blur()" onClick="src('Text','J.W. Kinder!'); return false;" onMouseOver="drc('Information and Links Available here.','Click to Stick A Description and Links.'); return true;" onMouseOut="nd(); return true;">
<img src="http://www.proamrodeo.com/jpg/jwcard.jpg" border="0"></img></a>
</DIV>
<DIV STYLE="position:absolute; top:320px; left:300px; width:165px; border-width:0; visibility: visible; z-index:2">
<a href="javascript:void(0);" onfocus="this.blur()" onClick="src('Text','J.W. Kinder!'); return false;" onMouseOver="drc('Information and Links Available here.','Click to Stick A Description and Links.'); return true;" onMouseOut="nd(); return true;">
<img src="http://www.proamrodeo.com/jpg/sportsshot.jpg" border="0"></img></a><BR>
</DIV>
<DIV STYLE="position:absolute; top:390px; left:150px; width:165px; border-width:0; visibility: visible; z-index:1">
<a href="javascript:void(0);" onfocus="this.blur()" onClick="src('Text','J.W. Kinder!'); return false;" onMouseOver="drc('Information and Links Available here.','Click to Stick A Description and Links.'); return true;" onMouseOut="nd(); return true;"><img src="http://www.proamrodeo.com/jpg/replay1.jpg" border="0"></img></a>
</DIV>



</DIV>
</BODY>
</HTML>

vera
08-05-2002, 12:47 AM
Regarding this,

<A HREF="java script:void(0);" onfocus="this.blur()" onClick="src('Text','J.W. Kinder!'); return false;"

For the HREF, I think "javascript" should not have a space in it. But it could also be empty because the "return false" will cancel the normal HTML action. So it could just as well be, HREF="". I have used, HREF="javascript:function()", which works on some browsers and not others, so I don't use it at all anymore; I just put the code in the "onclick" with "return false" and set the HREF="".

About the "onclick="src(...)", is a function you made, right? I didn't see its definition in your listing, maybe it's in the js file. I'm thinking there might be a conflict with a reserved word. Maybe rename that function.

I'm not sure why it doesn't work but you might try this change,

<A HREF="" onfocus="this.blur()" onClick="fetch('Text','J.W. Kinder!'); return false;" ....

I took out the HREF stuff because it isn't going to do anything anyway (because of "return false") and it might be causing an error. And, I renamed the function to "fetch" in case "src" is being perceived as a name-use travisty. Of course, the function name would have to be changed in the js file also.

glenngv
08-05-2002, 09:28 AM
i think there's no onclick event for <A> tag in NS4. I've also experienced that. That's why I used href="javascript:" instead

brothercake
08-05-2002, 11:01 AM
Originally posted by glenngv
i think there's no onclick event for <A> tag in NS4. I've also experienced that. That's why I used href="javascript:" instead

A tags in NS4 do support the onclick handler. But using javascript: urls is probably easier, because it saves all that messing around with voiding the link href - incidentally void would generate a strict-warning "useless expression". You don't need it all. Simply

<a href="javascript:src('Text','J.W. Kinder!')" ...

would work. if not, let's see the udnerlying code that's called by that function


btw - ignore space between "java" and "script" - it shouldn't have a space - the forum's adding that for some reason



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum