It seems you have to learn HTML and CSS before you try Javascript.
invertMe() is the function
in the <script type='text/javascript'>... </script>
Did you run my code in a test.html ?
in IE it does displays nothing.
Oh, but it does.
Did you put my code in a seperate test.html as I expect you to do?
Or did you put other lines in it? Don't.
Is this code to test some other
browser?
No, IE works fine.
:)) Hi Evertjan ,
I tried pasting it in my code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<div style="position : absolute; width: 100px; height: 100px; z-index:
1; background= #aaccdd" id="layer1">
</div>
<script type='text/javascript'>
function invertMe(x){
var t1 = '0123456789abcd ef#'
var t2 = 'fedcba98765432 10#'
x.style.backgro undColor =
x.style.backgro undColor.replac e( /./gi,
function (s) {
return t2.charAt(t1.in dexOf(s));
}
)
}
</script>
<div style='backgrou nd-color:#c0c0c0;w idth:50px;'
onclick='invert Me(this)'>
1. Click me to invert my background</div>
<br><br>
<div style='backgrou nd-color:#fe3456;w idth:50px;'
onclick='invert Me(this)'>
2. Click me to invert my background</div>
</body>
</html>
I had the impression there was a block missing (perhaps was somehow
covered).
Is "background " the same as "background-color" I see you use the
latter. I always used the first. Is this a mistake?
-P