...

View Full Version : Help! IE / Mozilla compatibility problem...



kieryn
01-07-2007, 05:29 PM
This is some ASP code with some simple DHTML.
It's supposed to create a table grid of pixels that change color as the mouse goes over them. It works fine in Mozilla buy not in IE. Someone please help!!!



<html>
<head>
<script language="javascript">

function paint(td) {
td.style.backgroundColor = 'black';
}

</script>
<style>

table {
border-spacing: 0;
border-style: solid;
border-width: 1px;
border-color: black;
border-collapse:collapse;
padding: 0;
}

td {
border-style: none;
border-width: 0px;
padding: 0;
}

</style>
</head>
<body>
<table>

<%
For y = 1 to 32
response.write "<tr>"
For x = 1 to 32
response.write "<td height=2px width=2px name='td_" & x & "_" & y & "' "
response.write " style='background-color: white;' onmouseover='javascript: paint(this);'>"
next
next

%>
</table>
</html>

SpirtOfGrandeur
01-08-2007, 08:11 AM
Let me help you clean this up a bit, then we can discuss changes.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function paint(td) {
td.style.backgroundColor = 'black';
}
</script>
<style type='text/css'>
table {
border-spacing: 0;
border-style: solid;
border-width: 1px;
border-color: black;
border-collapse:collapse;
padding: 0;
}

td {
border-style: none;
border-width: 0px;
padding: 0;
height: 2px;
width: 2px;
background-color: white;
}
</style>
</head>
<body>
<table>
<%
For y = 1 to 32
response.write "<tr>"
For x = 1 to 32
response.write "<td name='td_" & x & "_" & y & "' "
response.write " onmouseover='paint(this);'>"
next
next
%>
</table>
</body>
</html>


I tested this in IE6.0 and it works correctly. You really should have a <tbody> though. Let me know how it goes for you.

kieryn
01-08-2007, 09:22 PM
the suggested changes make the code work fine on both IE6 and mozilla.

thanks so much!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum