Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically text change in table 1

Status
Not open for further replies.

Mohawk1103

Technical User
Oct 15, 2008
3
BE

Hello all,

I hope you can help me..
I'm having a 1row-2column table on my html-page.
Through javascript I'm trying to have the text showing in these table cells, based on an array previously defined (hardcoded text, no user input).
I gave each cell an ID ("left" and "right")

function writetxt()
{
document.createElement("left") = "first picture left";
}

<td><div ID="left">xxxxxxx</td>


I've the feeling I need to use .innerHTML somewhere but I'm stuck..

So the question is: how can I replace xxxxx through the javascript based array?

(the cell contents should be shifting from right to left after 5 secs, the right being filled in with the next key in the array)

Thanks in advance for any help..
 
Thanks for the tip already!
Well, I thought about that and then replace within the function somehow the next in array. But I'm stuck where to refer back to the cell contents.

<html>
<head>
<meta name="generator"
content="JS Editor v9,
<title>Debugging JavaScript Code (2)</title>
<script language="JavaScript"
type="text/javascript">

var myNotes;
var ABC;
myNotes = new Array("hello1", "hello2", "hello3", "hello4", "hello5", "hello6");
writetxt();
function writetxt()
{
ABC = document.getElementById("left");
}
</script>
</head>

<body onload="writetxt()">
<table width="50%"
border="10">
<caption>
Comments
</caption>

<tbody>
<tr>
<td><div ID="left">hello</div></td>

<td><div ID="right">bye</div></td>
</tr>
</tbody>
</table>
</body>
</html>
 
You're a star!
My newborn baby will love you too for helping with his pictures :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top