Discussion Locked

Web-based puzzle

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Want to display solid-color squares, then when the user clicks on one, the square and the surrounding squares change color.
I've tried using

_

and ChangeColor would do something like:
document.$Parm.setcolor(Red)
but nothing ever changed color.
Can this be done in JavaScript? How?

9 replies

by kevin.riggs

Javascript is one of the technologies you might want to use to accomplish this but my first thought is that you need to use DHTML (browser specific) to delineate the areas rather than using a table.

In DHTML for IE,

Function Changecolor(squareID)

document.all(squareID).bgcolor = red

End Function

The DHTML will have to be different for Navigator. You can lookup DHTML in the online help at http://msdn.microsoft.com/ or at Netscape's site or you can find some books like Dynamic HTML (ISBN 0764580531) from IDB Books.

I know this isn't a straightforward tutorial or answer but this can be complicated when you're working across browsers and you want to dynamically affect a stateless environment that was originally designed tobe a 'round trip' way to communicate between server and clients. :)

by al_<al

Given the limitation of non browser specific features, and interpreting that literally, the ONLY answer here is that this cannot be done. JavaScript itself is a browser specific feature.

Assuming you can build something that will work in Netscrape 3.x or above and/or IE 4.x or above, the best solution is to use JavaScript to swap inline images within each table cell. Frontpage and or Dreamweaver can make this task simple. Email me if you need code samples.

by cedric king

From what I know, you can't access just a cell. You can use a img src though. OnMouseOver, change the src to another and onMouseOut, change it back.

This discussion is closed to new replies.