Inhalt ändern
Jimmy
- css
Moin !
Hier erst mal mein Progamm:
<html>
<title>Test</title>
<body>
<input type="button" name="knopf" value="Hallo" onclick ="javascript: knop();">
<script>
document.write('<style type="text/css">');
document.write('#box1 { position:absolute; top:100px; left:110px; width:150px; height:150px; z-index:1; }');
document.write('</style>');
document.write('<div id="box1" >Hi</div>');
function knop(){
document.getElementById("box1").style.value = "hallo";
}
</script>
</body>
</html>
Will denn Wert von Box1 (Hi) zu "Hallo" umändern wenn
der Knopf gedrückt wird.
Hab es mit:
document.getElementById("box1").style.value = "hallo";
probiert geht aber nicht.
Danke.
Hallo,
Hab es mit:
document.getElementById("box1").style.value = "hallo";
probiert geht aber nicht.
document.getElementById("box1").firstChild.nodeValue = "hallo";
oder
document.getElementById("box1").childNodes[0].nodeValue = "hallo";
oder in den Browsern, die auch die anderen Varianten kennen:
document.getElementById("box1").innerHTML = "hallo";
MfG, Thomas