Thema: setStyle
Hallo,
ich möchte gerne Style Eigenschaften ändern und verwende folgenden Code der Seite 282:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Test01</title>
<script src="./lib/prototype.js" type="text/javascript"></script>
<script src="./lib/scriptaculous.js" type="text/javascript"></script>
</head>
<body>
<div id="bsp" style="color:#ff0000;">Test</div>
<a href="#" onclick="Element.setStyle('bsp', {color:'#0000ff', fontSize:'130px'} );">setStyle</a><br />
</body>
</html>
Hier bekomme ich die Fehlermeldung: is not a function
Also so versucht:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Test01</title>
<script src="./lib/prototype.js" type="text/javascript"></script>
<script src="./lib/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
// <![CDATA[
function test() {
Element.setStyle('bsp', {color='#0000ff'});
}
// ]]>
</script>
</head>
<body>
<div id="bsp" style="color:#ff0000;">Test</div>
<a href="#" onclick="test()">setStyle</a><br />
</body>
</html>
Dann lautet die Fehlermeldung: missing: after property id
Was mache ich falsch?
Vielen Dank im Voraus
Hans-Jürgen