this keyword can be very important but it is also confusing as not clear what it refers to at times.
-
Also not always clear when needed
|
Here is an example of use to set URL for a link
|
function seturl(obj) { // Put in <head></head> Part of document
|
obj.target = "Desiredframe"; // set frame you want it to go in!
|
obj.href="http://www.npac.syr.edu"; // or calculate URL dynamically
|
}
|
In normal HTML page place:
|
<a href="" onClick="seturl(this)" onMouseOver="window.status='URL set dynamically in routine seturl';return true" >Click Here for Dynamic URL</a>
|
Here this refers to link object created by <a ..> </a>
|
window.status is line at bottom which usually records URL
|
Note can specify nontrivial href and onClick but if onClick specifies href property it overrides that in HTML page
|