Well, one more example of "asking for help reveals the answer",
in this case partially.

This revised code shows that the blanking out upon mouseout, where
I am using a variable id, works, but I'm still not getting the color
upon mouseover, whether I use a hardcoded id or a variable
=======
....
<td style="border:thin solid"
onMouseOver="showColor( ' . $tableCounter . ' )"
onMouseOut="blankOut( ' . $tableCounter . ' )">' . $name . '</td>
....

function showColor ( i ) {
  var where = 'color' + i
  xmlHttp = getXmlHttpObject()
  var uri = 'getColor.php?where=' + where
  uri = uri + '&sid=' + Math.random()
  xmlHttp.onreadystatechange = stateChanged( where )
  xmlHttp.open( 'GET', uri, true )
  xmlHttp.send( null )
}

function blankOut ( i ) {
  var where = 'color' + i
  // this works (using a testing value instead of '' for visibility)
  document.getElementById( where ).innerHTML = 'x'
}

function stateChanged( where ) {
  if ( xmlHttp.readyState == 4 || xmlHttp.readyState == "complete" ) {
    // these both get the correct response
    // but neither loads the innerHTML
    document.getElementById( 'color1' ).innerHTML = xmlHttp.responseText
//    document.getElementById( where ).innerHTML = xmlHttp.responseText
  }
}


--
=================
Michael Southwell
Vice President, Education
NYPHP TRAINING:  http://nyphp.com/Training/Indepth
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to