Jump to content

Inner HTML Firefox


barkster

Recommended Posts

Why doesn't this work in firefox?  It works in IE and if I manually type in the 'ch1' it will change it but if I use the var it will not work in firefox.  Thanks

 

function deleterow(rvalue) {
        var answer = confirm("Are you sure you want to delete?");
        var values = rvalue.split("|");
    if(answer){
	    var chours = 'ch' + values[0];
	    var bhours = 'bh' + values[0];
	    alert(chours + "----" + bhours);
	    document.getElementById(chours).innerHTML = "CH1"
	    document.getElementById(bhours).innerHTML = "BH1"
    } else { 
	    alert(values[0] + '-' + values[1] + '-' + values[2] + '-' + values[3]);
    }
}

     

Link to comment
Share on other sites

Ah, that makes perfect sense.  For some reason it still won't work.  Maybe it is something on my machine.  No huge deals since it works in IE and will be deployed on IE platforms but I like to develop for firefox cause you know it will work in just about anything if you do.  Thanks

Link to comment
Share on other sites

Well I can't get it to work in either IE or Firefox.  Here is what I have stripped down.  If you click on the first "delete row" link it should change the text in the div but will only do it with the hard coded values.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Time Report
</title>
    <script language="javascript" type="text/javascript">
    function deleterow(rvalue) {
        var answer = confirm("Are you sure you want to delete?");
        var values = rvalue.split("|");
    if(answer){
            chours = "document.getElementById('ch"+values[0]+"').innerHtml=\"CH1\"";
	    bhours = "document.getElementById('bh"+values[0]+"').innerHtml=\"CH1\"";
	    alert(chours);
	    eval(chours);
	    eval(bhours);
	    document.getElementById('ch2').innerHTML = "What a pain"
		document.getElementById('bh2').innerHTML = "in the Ass"
    } else { 
	    alert(values[0] + '-' + values[1] + '-' + values[2] + '-' + values[3]);
    }
    }
    
    </script>
</head>
<body>
<div id="divRows">
  <table width="700" order="0" cellspacing="0" cellpadding="0"><tr bgcolor="#FFE0C0" id="77581" style="display:block">
    <td width="100%"><A HREF="javascript:deleterow('1|77581||8')">Click here delete entry</A></td>
  </tr><td background="images/line.gif"><img src="images/spacer.gif" width="1" height="1"></td></tr><tr bg="FFFFFF"><td align="right"><div id="ch1">Computer Hours: 0</div> <div id="bh1">Billable Hours: 8</div></td></tr><tr bgcolor="#FFFFFF" id="77582" style="display:block"><td><A HREF="javascript:deleterow('2|77582||8')">Click here delete entry</A></td></tr><td background="images/line.gif"><img src="images/spacer.gif" width="1" height="1"></td></tr><tr bg="FFE0C0"><td align="right"><div id="ch2">Computer Hours: 0</div> <div id="bh2">Billable Hours: 8</div></td></tr><tr bg="FFE0C0"><td> </td></tr></table>
</div>
</body>
</html>

Link to comment
Share on other sites

Try this function

function deleterow(rvalue) {
        var answer = confirm("Are you sure you want to delete?");
        var values = rvalue.split("|");
    if(answer){
		document.getElementById('ch'+values[0]).innerHTML = "CH1";
		document.getElementById('bh'+values[0]).innerHTML = "BH1";
    } else { 
	    alert(values[0] + '-' + values[1] + '-' + values[2] + '-' + values[3]);
    }
    }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.