Log in

View Full Version : Table replacement



viktor
02-20-2006, 02:28 AM
I got this code:

<table id="Table1" bordercolor="#000000" height="75" cellspacing="0" cellpadding="0" width="435"
border="1">
<tr>
<td valign="middle" align="center" width="435" style="word-wrap:break-word"><span class="blacktext12">
<span id="ctl00_Main_ctl00_UserNetwork1_ctrlMessage">This text right here.</span>
<br>
</span>
</td>
</tr>
</table>

How can I remove this table and place another one using HTML/CSS/DHTML no JavaScript, I can add those three on the website through a module.

Any help will be appreciated, oh maine reason is to replace the text inside.

Twey
02-20-2006, 05:13 PM
DHTML is the application of Javascript and CSS to make HTML "Dynamic" :)
... you can just change the code?

viktor
02-21-2006, 05:53 AM
well, i know that. But it says on site, that you can use HTML/DHTML and CSS but not javascript well i never used dhtml on it because it never worked.
I can't change code just like that, its in original site, its in my profile, but they offer modules to change whatever we want in it. I was unable to figure it out, how to change text inside this table or remove the table and place a new one.

Twey
02-21-2006, 05:47 PM
Well... you can access all the HTML inside the table with document.getElementById("Table1").innerHTML. Make what changes you like. But that's Javascript. It's not possible without Javascript.

viktor
02-24-2006, 09:24 AM
Well... you can access all the HTML inside the table with document.getElementById("Table1").innerHTML. Make what changes you like. But that's Javascript. It's not possible without Javascript.

Ok, same problem different site now I can use javascript, can you elaborate on document.getElementById("Table1").innerHTML
I'm guessing Table one is the ID where new contents go ?
can you just show me simple code?

thankyou

Twey
02-24-2006, 05:04 PM
You are right to guess that.
var ht = '<tr><td><img src="file.jpg" /></td><td><img src="file.png" /></td></tr>';
document.getElementById("Table1").innerHTML = ht;All the HTML inside the <table> tags will be replaced by what you set the innerHTML property to. I suggest writing to a variable first, as, if you write half a piece of HTML directly to the innerHTML property, the browser may attempt to compensate, resulting in odd effects.