This code works perfectly in IE 7 and above. The PHP/HTML code has a button to delete/undelete some data. When the icon/button is clicked it enters the javascript function "setdelete". The following HTML code sets up the button for entry into the javascript function.

<button id="$delete_icon" value="Delete" onclick="setdelete($key)"><img id="$m_d_img_name" src="images/x_undelete.ico"/></button>

When the javascript is entered, it sets a few variables (not shown), changes the button icon (shown) and returns to the PHP code. Basically, it just returns to the indows where various items haven been displayed. In IE it reurns to the window without any problems and the icon has been changed correctly by javascript. In Firefox, it wants to return to the beginning of the PHP code, as if it was an initial entry. This doesn't work as I pass parameters between PHP modules (e.g ?Xyz=Dothis) so windows isn't just re-displayed by the javascript return.It's like a new execution of the PHP code. This is incorrect. Worked fine in IE but not in Firefox. Below is the javascript.

Function setdelete(key)
var m_img = "m_icon" . concat(key); // get unique name
document.getElementById(m_img).src = "images/x_delete.ico";
3 Years
Discussion Span
Last Post by wfray

Hi Wfray

It may be that your button tag is performing a form post / submit on firefox and not on IE ? It is the only thing I can think of. Try adding onsubmit="return false" inside your form tag to test my theory.

If that's not it then I am out of ideas.


That fixed the problem. Thank you so much. I researched the dickens out of this; posted it on three sites; tried several different coding approaches to no avail. hat a relief. Great job!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.