Forum Moderators: open
I am with the code below, but he is with mistake. I did not manage to discover where is. Could anybody help?
--------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function Test(x, z){
if(x == "owntest"){
var a1 = document.getElementById('owntest').style;
a1.font = z;
}
document.forms.form.elements[x].value = z;
}
</script>
<body>
<form name="form" id="form">
<div id="owntest">testing...</div>
<a href="#" onclick="Test('owntest', 'bold')">Button</a>
</form>
</body>
</html>
---------------------------------------------------------------
Script changes of normal for bold, however a mistake appears on the page. What has to wrong?
Thanks
document.forms.form.elements[x].value = z;
'owntest' is not part of the elements collection of the form called 'form'. What are you trying to achieve with that line?