• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

anchor tag and window.event.srcElement dont work

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello ranchers,
I am trying to retrive the anchor tag clicked, in the javascript function.


i get object required, am i missing something here?

Any help would be appreciated,

Thanks,
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is that really your code? The test function is never referenced.
 
John Robert
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, My mistake.For some reason, my code has been edited. I think I did not disable the html. The actual code for the anchor tag is,



Thanks,
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No one edited your code. Please take better care when posting. And be sure to proof-read afterwards.

Also, you are aware that the code you wrote will work only in IE, right?

Lastly, using the "javascript:" pseudo-protocol is the not the same as event handling and so it is likely that no event instance is available the way that it would be with an onclick handler. I can't test that however as I do not run Windows.

So first, check that the event instance at window.event exists. If not, you'll need to do this differently (and in a more standard manner).
 
John Robert
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

No one edited your code


I dint mean some one edited my code, alll I was trying to point is, the editor rendered my code as html. I will try to be more careful from next time.

Bear, you were right. The windows.event turns out to be null, if i call javacript on href. I tried this


but now the alert comes out as

file:///C:/Documents%20and%20Settings/test/My%20Documents/temp.htm#

.

I am lost. All I am trying to do is, get the src anchor element clicked, so that I can disable it.

Thanks,
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


get the src anchor element clicked, so that I can disable it.



you can set "id" attribute to set a tag and pass the event to function like this. why do want to dsiable anchor tag ?!?!

 
John Robert
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that worked thanks.

why do want to dsiable anchor tag


Based on some conditions, I am opening a new window using window.open. So I want to disable the anchor tag, till the new window loads. I couldnt figure out another way to do it, so I am getting the corresponding anchor tag clicked, and disabling it till the new window loads. On load of the new window, i am calling a javascript on the opener window to re enable the link. Is there an easier way to deal with this?

thanks,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic