Alter content (tables) [IE only]

[Total: 0    Average: 0/5]

This shows how to have content altered by rewritting the html inside a component. (IE only)

Head Code:

<script>
var IE=document.all?true:false;
var _r = new Array();
    _r[0] = '<table><tr><td>text in table 1</td><td><input type=text name=t1 value="<input1>"></td></tr></table>';
	_r[1] = '<table><tr><td>text in table 2</td><td><input type=text name=t2 value="<input2>"></td></tr></table>';
	_r[2] = '<table><tr><td>text in table 3</td><td><input type=text name=t3 value="<input3>"></td></tr></table>';
</script>

Body Code:

<form name=exf1>
<script>
if (IE) {
document.write("<div id=r1>"+_r[1]+"</div>");
document.write("<div id=r2>"+_r[2]+"</div>");
}
</script>
<table><tr><td><input type=button value="button1" name="button1" onclick="mode(1)"></td>
           <td><input type=button value="button2" name="button2" onclick="mode(2)"></td></tr></table>
</form>
<script>
function mode(_v) {
  if (IE) {
    var _a = document.all.r1;
    var _b = document.all.r2;
    if (_v == 1) {
      _a.innerHTML = _r[0];
  	_b.innerHTML = "";
    }
    if (_v == 2) {
      _a.innerHTML = _r[1];
  	_b.innerHTML = _r[2];
    }
  }
}
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *