where is the currentNode in hyperlink?

S

student4life

Hello,

Could someone show me where the current node is if a user clicks on
the hyperlink 'someLabel' in the the example below? Thanks.

<li>
<a href="javascript:someFunc(this)">someLabel</a>

<div id="someId">someText</div>
</li>
 
E

Evertjan.

student4life wrote on 02 aug 2009 in comp.lang.javascript:
Could someone show me where the current node is if a user clicks on
the hyperlink 'someLabel' in the the example below? Thanks.

<li>
<a href="javascript:someFunc(this)">someLabel</a>


====================================
<script type='text/javascript'>
var c = 'global'
</script>

<a href="javascript:alert(this.c);">returns: global</a>

<br>

<a href="javascript:return false;"
onclick="alert(this.tagName);">returns: A</a>

<br>

<a href="javascript:alert(this.tagName);"
returns: undefined</a>

<br>

<a href="javascript:return false;"
onclick="alert(this.c);">returns: undefined</a>
===========================================

tested on Chrome
 
T

Thomas 'PointedEars' Lahn

student4life said:
Could someone show me where the current node is if a user clicks on
the hyperlink 'someLabel' in the the example below? Thanks.

What is a "current node"? Have you been reading a bad book?
<li>
Relevance?

<a href="javascript:someFunc(this)">someLabel</a>

This is not really a hyperlink, see also <http://validator.w3.org/>.

As the value of a `href' attribute, if it is a `javascript' URI, is
executed, if it is supported, in the global execution context, `this'
refers to the global object. This is different to the value of intrinsic
event-handler attributes where `this' usually refers to the object that
represents the event target.

<div id="someId">someText</div>
</li>

Relevance?


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top