Same old same old, my javascript runs fine in IE but not with Firefox. I've followed all the forms, checked all the forums and responses, and what I've got coded up should work but it's not. Firebug shows the value as "undefined."
Here's what I've got; it's scaled down from a much bigger application, but it shows the same problem:
<html>
<head>
<script type="text/javascript">
function show_alert(evt)
{
if( !evt )
evt = window.event;
var eSrc;
if( evt.srcElement )
eSrc = evt.srcElement;
else
eSrc = evt.target;
if( eSrc.tableisloaded == "showAlert" )
alert("alert box: " + eSrc.name + "|" + eSrc.type);
}
</script>
</head>
<body>
<input type="button" name="clickme" tableisloaded="showAlert"
onclick="show_alert(event);" value="Show alert box" />
</body>
</html>
When I run this in IE, I get the alert, which means it is finding the "tableisloaded" argument. Firebug doesn't show it all.
So what am I doing wrong, and is there a way to access the argument? Will I need to change it to a parameter (onclick="show_alert(event,"showAlert");
)? I am hoping NOT as it will require a major rewrite of a LOT of code.
Thanks
Try eSrc.getAttribute("tableisloaded")
Also, if you want to be hip and trendy, you might consider making your pages HTML5 and calling your extra attribute "data-tableIsloaded". That way it'll validate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With