Jump to content

What a *anchor!!


dooberry
 Share

Recommended Posts

Hi guys,I'm having some trouble. I don't want to use a button or an image for what I'm doing so I thought an anchor would solve the problem (except it doesn't). :) I need some text to trigger a function on my web page when it is clicked. I tries using an anchor without a URL attached to it, but it behaves as normal text and doesn't do anything.my code is:

<a onclick="function()">click here for something to happen</a>

I assume it's because the anchor is empty. Is there another tag I can use?

There is a spoon!!! It's there! I can see it in your hand! No spoon - pah!!!!!
Can anyone help please?Dooberry
Link to comment
Share on other sites

Well, next time, to promote cross browser, make sure you have 'java script:' in front of the function.

<a onclick="javascript:function()">click here for something to happen</a>

Link to comment
Share on other sites

Thanks for the tips, they're always useful.We all know that Billy Gates is taking over the world though so it's only a matter of time before IE is the only browser you can get for your Xbox PC multimedia station complete with integral wallpaper!! :)I'm still a newbie really, just a busy one.

Link to comment
Share on other sites

Remember that the anchor does in IE seem to do something it doesn't do in other browsers, so you can also use <span> if you want, which does not do anything at all exept binding some content into one element :)

Link to comment
Share on other sites

Besides, images won't load after you clicked an anchor untill the next page is loaded.And last, an anchor wo'nt be recognised as so ever by IE, if it hasn't a HREF attribute specified :) It disables click :)<span> would be the best sollution I think :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...