Simple question on html input form

January 21, 2009 at 13:21:19
Specs: Windows Vista, e8400/4gb
Hey guys, to cut to the chase, I have an input form for a basic calculator that our tutor gave us. I'm editing this so that instead of "input type="button"" it should be "input type="image"..> I can get the image I want to display perfectly. But internet explorer is ignoring the onClick event that puts the numerical value of the image on the form of the calculator, and just refreshes the page instead! I cant get round this, cheers for any help!

See More: Simple question on html input form

Report •

January 22, 2009 at 18:38:01
I think there's a bug in the way IE handles forms - buttons with images; try reading over this blog and see if maybe it will help. Do you need a button? If you're using javascript, how about TD along with a background image?

<script language="javascript">

var sum = 0;

function change(id) {

   sum += parseInt(id);
   document.getElementById("txt").innerHTML = sum;
<td background='somefile.gif' id='7' onclick='change(;'>7</td>
<td id='8' onclick='change(;'>8</td>
<td id='9' onclick='change(;'>9</td>
<td id='4' onclick='change(;'>4</td>
<td id='5' onclick='change(;'>5</td>
<td id='6' onclick='change(;'>6</td>
<td id='1' onclick='change(;'>1</td>
<td id='2' onclick='change(;'>2</td>
<td id='3' onclick='change(;'>3</td>
<td id='0' onclick='change(;'>0</td>
<td id='a'> </td><td id='b'> </td>
<p id='txt'></p>

What code do you have?

Report •
Related Solutions

Ask Question