The following PHP code works fine with javascript in Internet Explorer but fails in Firefox. Javascript is enabled in Firefox. It appears that when the button/icon is clicked, it enters the javascript function, but doesn't change the icon on the page. It also seems to return to the PHP code/page incorrectly. The PHP code/page was entered with a parameter (http://www.PRCmembership_admin.php?PRCma=payment). When it apparently returns from javascript, the ?PRCma=payment is missing.

PHP Code:

$mt_deleteicon_name = "mt_deleteicon" . $tranrec;   //Unique name associated with a mysql record
$mt_deleteimage_name = "mt_deleteimage" . $tranrec; // Ditto for icon image
$mt_delete_name = "mt_delete" . $tranrec; // Ditto for delete indicator
<button id="$mt_deleteicon_name" value="Delete" onclick="settdelete($tranrec)">
<img id="$mt_deleteimage_name" src="images/x_delete.ico" /></button>

Javascript Code:

function settdelete(trankey)


var mtdelname = "mt_delete" . concat(trankey);
var mticonname = "mt_deleteicon" . concat(trankey);
var mtimagename = "mt_deleteimage" . concat(trankey);
document.getElementById(mtdelname).value = "D";
document.getElementById(mtimagename).src = "images/x_undelete.ico";


Edited by Dani: Formatting fixed

3 Years
Discussion Span
Last Post by wfray

An update: apparently when the icon is clicked, the referenced javascript is never entered. I added an alert("javascript entered"); and it never popped up. Javascript is definately enabled in firefox.


How are you calling settdelete(trankey)?

Also, you may want to check support for .ico as a valid image type in firefox...

Also, in javascript:

var String1 = "a" + " string";

is the same as 

var String2 = "a".concat(" string");

settdelete(trankey) gets called when the icon gets clicked as part of the <button...onclick="settdelete($tranrec) HTML code. I also updated JAVA to its newest version. The javascript function now gets called but when it returns it has eliminated an HTML variable that was included as part of the original call to the PHP script. Apparently Firefox does some things quite differently from IE. Rather than fool around with coding specific to a given browser, I'm just going to convert the PHP code to use $_SESSION variables instead of HTML variables/parameters. It'll be independent of any browser.

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.