You could attach an onclick event handler to make something happen when the button is clicked.Is that what you mean?

jelly46
—
2012-11-22T12:31:44Z —
#3

No i need to work on the Javascript in the header only. The button code is a plugin for a cms and i have no access to add anything to it. I only have the header and Javascript to work with. Thanks mate

Pullo
—
2012-11-22T12:32:56Z —
#4

How is the button being included?Can you provide a link to the page in question?

Yup, my mistake, it was broken in IE 8 and below.Try this, it should work in all browsers:

`html

`

Hope that helps.

You are inserting the JavaScript in the wrong place in the page and so need extra JavaScript to delay the script running until after the point where you should have attached the JavaScript. JavaScript should be attached immediately before the </body> tag. It should only ever go in the head if the code is testing whether to allow the current page to display or to load a different one without loading this one.

This is true, but I figured the OP wanted it in the head for whatever reason.

jelly46 said:

... that and needs to be read by Javascript in the header if it has been clicked

felgall
—
2012-11-23T01:19:11Z —
#15

Pullo said:

This is true, but I figured the OP wanted it in the head for whatever reason.

Probably just copying all the JavaScript that was written for Netscape 2, 3 and 4 where the JavaScript mostly went in the head rather than working with more modern browsers such as IE5+ that work better with the JavaScript at the bottom of the body.