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";
return;
}

Recommended Answers

All 2 Replies

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!

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.