[nycphp-talk] need ajax help REVISED
Edward Potter
edwardpotter at gmail.com
Wed May 21 21:38:04 EDT 2008
this may have no relevance at all, but don't u need the semi-colon for
the inline style declaration?
style="border:thin solid;" vs style="border:thin solid"
On Wed, May 21, 2008 at 9:24 PM, Michael Southwell
<michael.southwell at nyphp.com> wrote:
> 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
>
--
IM/iChat: ejpusa
Links: http://del.icio.us/ejpusa
Blog: http://www.preceptress.com
Follow me: http://www.twitter.com/ejpusa
Karma: http://www.coderswithconscience.com
Projects: http://flickr.com/photos/86842405@N00/
Store: http://astore.amazon.com/httpwwwutopic-20
More information about the talk
mailing list