nochmal dynamisches CSS mit JavaScript
Andreas
- css
0 Pawel
Hello again
Ich habe nun ein weiteres Problem mit einem <DIV>. Hier der Quelltext:
____________________________________
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>menu - test</title>
<style type="text/css" media="screen"><!--
#button1 { color: white; font-weight: bold; font-size: 10px; font-family: Verdana; text-decoration: none; background-color: #ffa07a; padding: 3px; border-style: solid; border-width: 2px; border-color: #808080 black black #808080; position: absolute; z-index: 2; top: 25px; left: 25px; width: 120px; visibility: visible; display: block }
--></style>
<script type="text/javascript"><!--
function button1() {
onmouseover="button1.style.borderBottomColor='red'"
onmouseover="button1.style.borderRightColor='red'"
}
// -->
</script>
</head>
<body bgcolor="#dcdcdc" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
<div id="button1" onmouseover="javascript:button1()">Button1</div>
</body>
</html>
____________________________________
Was bitte stimmt mit der Funktion nicht? Wieso ändert sich die Rahmenfarbe nicht. Ich bin mir diesmal sicher, das die Attributbezeichnung richtig ist. Aber es funktioniert einfach nicht. Wer kann mir helfen? Danke.
Gruß aus Dresden. Andreas
Hallo Andreas,
1. Der Funktionsname darf nicht gleich mit der ID sein.
2. onmouseover="..." wird in diesem Fall nicht funktionieren. Einführungszeichen müssen weg!
--------------------
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>menu - test</title>
<style type="text/css" media="screen"><!--
#button1 { color: white; font-weight: bold; font-size: 10px; font-family: Verdana; text-decoration: none; background-color: #ffa07a; padding: 3px; border-style: solid; border-width: 2px; border-color: #808080 black black #808080; position: absolute; z-index: 2; top: 25px; left: 25px; width: 120px; visibility: visible; display: block }
--></style>
<script type="text/javascript"><!--
function MO_button1() {
button1.style.BorderBottomColor='red';
button1.style.borderRightColor='red';
}
// -->
</script>
</head>
<body bgcolor="#dcdcdc" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
<div id="button1" onmouseover="javascript:MO_button1()">Button1</div>
</body>
</html>
--------------------
Gruß, Pawel
http://www.pkworld.de