Click to See Complete Forum and Search --> : adding tables to a DIV
cul8er23
09-01-2003, 08:37 AM
:confused:
Hi everyone,
I'm trying to add tables to an existing DIV, which works fine in netscape but not in IE (script works there too but nothing shows). Can anyone please take a look at the attached script?
Thanks
Khalid Ali
09-01-2003, 08:57 AM
I have used a work around(in absence of a real solution to this)
suppose you have appended all of your contents to the div elementnow you only need to do this
if(document.all){
divRef.innerHTML = divRef.innerHTML;
}
cul8er23
09-01-2003, 09:11 AM
:(
thanks,
but I am afraid your answer is too abstract for me.
I'll have to think about it.
:rolleyes:
Khalid Ali
09-01-2003, 09:15 AM
Originally posted by cul8er23
:(
....too abstract for me.
Lets see..well you said in your question that your code works in Netscape right?
that means you are creating table or tr or tdees sucessfully and they are being shown as well.
now the last part of the code has to be something like this
divElement.appendChild(All of your dynamic contents)...right?
Now see if this makes any sense to you.
<script type="text/javascript">
function Process(val){
var frm = document.getElementById("form1");
var tbl = document.createElement("TABLE");
var tbd = document.createElement("TBODY");
var trs = document.createElement("TR");
var tds = document.createElement("TD");
trs.appendChild(tds.appendChild(document.createTextNode("TD")));
tbl.appendChild(tbd.appendChild(trs));
var tdiv = document.getElementById("tb_div");
tdiv.appendChild(tbl);
if(document.all){tdiv.innerHTML = tdiv.innerHTML;}
}
//-->
</script>
</head>
<body class="body">
<form id="form1" action="" onsubmit="">
<input type="button" value="process" onclick="Process()"/>
</form>
<div id="tb_div">
</div>
cul8er23
09-01-2003, 09:16 AM
Oops,
that was easy, thanks a lot man.
Didn't think it could b that easy.
I already like this forum a lot.
Cheers
cul8er23
Khalid Ali
09-01-2003, 09:25 AM
you are welcome....;)
cul8er23
09-01-2003, 10:56 AM
Oops,
that was easy, thanks a lot man.
Didn't think it could b that easy.
I already like this forum a lot.
Cheers
cul8er23