I would like to be able to pass the link element ( not the URL) in an achor...
<p > i am content... <a href="#" onClick="foo(this); ">Show</a></p>
or PREFERABLY :
When I do this, the value of "this" is only the URL and not an ELEMENT object, whose attributes I can then modify via foo(). Is there a way I can actually access the <A> element and not just it's URL?
As always all insight is greatly appreciated.
That second alternative you prefer is one to AVOID as that does not associate the code with an event in any browser.
When you do try to reference this inside an event handler just which object it refers to will depend on the browser being used.
I was hoping to avoid using "#" as an href and my preferred method seemed to be a way to kill two birds with one stone, but what you are saying makes sense. There is only one drawback to the ID idea. That is, when having a list of items i would have to create an ID for each item.. but then again I suppose that just means what I really need to do is create a function that unobtrusively parses through all <a>'s in the menu...
You don't necessarily need to add an id to the a. You just need a way to select that anchor which is going to depend entirely on the entire pages structure. There is likely a way to target it without adding an id.
I am relatively new at PURE js ( having relied mostly on jQuery) I was toying with the idea of coding my own lightbox style slide show. So the idea was that sooner or later I would NEED anchors, since I would want the links to load the image in a new window IF js was off.
BTW, I actually got it working!! With only one problem... It works perfectly with CSS/ js on; it works as expected with js and CSS off; of course, it's a moot point with images/css/js off; but it's buggy when js is ON but CSS is off... ( Actually I just checked it again.. it works when CSS is OFF , but not if CSS is on but the style sheet is missing.. apparently That's two different things)
This makes sense as the script relies on CSS positioning as well margins to center the image. I guess I was wondering if you knew of a way for the script to tell when stylesheet was missing so that it could correct itself and act as if CSS was off?