I have a simple bit of code (contained in a CMS and cant be edited) that and needs to be read by Javascript in the header if it has been clicked.

Here is the code:

<div id="example" class="page-element-outer" style="text-align: left"><div class="page-element-inner" ><input type="image" name="Button1" id="Button" src="/getresource.axd?AssetID=16813" alt="Submit" style="text-align:left;" /></div></div>

Can you assist?

C

Recommended Answers

All 3 Replies

What do you mean read by JavaScript? You want to knowing the button has been clicked?

Yes exactly, i have developed this code:
I'm sure if it will work

<script type="text/javascript">
document.getElementById("Button").addEventListener("click", callback, true);

function callback() {
   alert("clicked");

   return false;
}
</script>

Yes, sure...an event listener should be the best way to approach this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.