Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: DHTML
Expertise: Beginner
Jan 29, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Dynamically Changing Table Values

I have a table that contains the values returned from a SQL database. I have created a division within each cell. The ID value for the division is the keyvalue of the recordset. On mouseover, the DIV that I store the name of the current DIV in is a hidden form input. I also move and make visible a select input item and set its value to the value currently in the table cell. The idea is that the user picks a new value and I update the table with the new value. I set the new value using this function:
function selectSupported(oObject){
	var strSelText =
oObject.options[oObject.selectedIndex].text //oObject is the
select input
	var strCurValue =
//getting the value currently in the table
	if (strSelText != strCurValue)
 = strSelText; //set the new value
This code works, however, it only works once. After I set the inner text of the DIV in the table cell, the table cell no longer responds to mouse over events. Any ideas?

While I can't see anything obvious, here's a couple of possibilities that you may want to explore. You may need to check that you're not inadvertently creating two DIVs with the same ID. If that happens, then referencing gets screwed up because you inadvertently create a collection with that ID. For example:

This is line 1
This is line 2
You'll generate an error if you then attempt to say in a script,
var data=document.all("mydoc").innerText
At this point, you actually need to refer to the entities as if they were a collection:
var data=document.all("mydoc")[1].innerText
alert data
This will pop-up an alert box saying "This is line 2".

You should also make sure you're not wiping out the object that contains the mouseover handler when you do the innerText call. I presume that you invoke the onchange event handler in the

Submit a Tip Browse "Web Development" Tips Browse All Tips
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date