K
Kirk Is
Hi there.
I'm trying to improve a simple javascript based graphics editor for
Atari 2600 games (long story) with better use of CSS and Javascript.
I'm a little weak on what CSS can and can't readily do (sometimes I'm
stuck in a Netscape 3 world, mentally) so I have a few questions:
Say I had an editor with some CSS like this:
<html><head>
<style type="text/css">
td.edt {background-color: yellow; height: 50px; width:50px}
</style>
</head><body>
<table>
<tr>
<td class="edt" name="00"></td>
<td class="edt" name="01"></td>
</tr>
<tr>
<td class="edt" name="10"></td>
<td class="edt" name="11"></td>
</tr>
</table>
</body></html>
1. Is there anyway to associate event handlers like onMouseDown with
every td of class "edt", or will I need to put the onMouseDown in the
tag of each td ? (Or do I need to get very complex with javascript
prototypes etc, so it would be easier just to do the individual
onMouseDowns ?)
2. Via javascript, can I modify the edt class so that, say, every
element using that class will change, like color or size?
3. Is there a better way of doing a basic graphics editor than to just
monitor onMouseDown / onMouseUp / onMouseOver ? It seems like I might
have a problem turning the "pen off" if the mouse leaves the table
entirely...can I capture a onMOuseOut for the whole table, or a <div>
surrounding it? When I tried that, it seemed like it was also setting
up a onMouseOut for the children <td> elements...
THanks
I'm trying to improve a simple javascript based graphics editor for
Atari 2600 games (long story) with better use of CSS and Javascript.
I'm a little weak on what CSS can and can't readily do (sometimes I'm
stuck in a Netscape 3 world, mentally) so I have a few questions:
Say I had an editor with some CSS like this:
<html><head>
<style type="text/css">
td.edt {background-color: yellow; height: 50px; width:50px}
</style>
</head><body>
<table>
<tr>
<td class="edt" name="00"></td>
<td class="edt" name="01"></td>
</tr>
<tr>
<td class="edt" name="10"></td>
<td class="edt" name="11"></td>
</tr>
</table>
</body></html>
1. Is there anyway to associate event handlers like onMouseDown with
every td of class "edt", or will I need to put the onMouseDown in the
tag of each td ? (Or do I need to get very complex with javascript
prototypes etc, so it would be easier just to do the individual
onMouseDowns ?)
2. Via javascript, can I modify the edt class so that, say, every
element using that class will change, like color or size?
3. Is there a better way of doing a basic graphics editor than to just
monitor onMouseDown / onMouseUp / onMouseOver ? It seems like I might
have a problem turning the "pen off" if the mouse leaves the table
entirely...can I capture a onMOuseOut for the whole table, or a <div>
surrounding it? When I tried that, it seemed like it was also setting
up a onMouseOut for the children <td> elements...
THanks