Hi,

Can anyone say, why the following TEXTAREA-enlargening javaScript does not work in Firefox even though it works ok in IE7?

<html> 
<head></head>

<body>
    <form name="form1" method="post" action="" id="form1">
        <br />
        <br />
        <textarea name="TextBox1" rows="4" cols="15" id="TextBox1" onClick="enLargeTbox(this.name)" onMouseOut="ReduceTbox(this.name)"></textarea><br />

        <textarea name="TextBox2" rows="4" cols="15" id="TextBox2" onClick="enLargeTbox(this.name)" onMouseOut="ReduceTbox(this.name)"></textarea><br />

        <textarea name="TextBox3" rows="4" cols="15" id="TextBox3" onClick="enLargeTbox(this.name)" onMouseOut="ReduceTbox(this.name)"></textarea>


<script language=javascript>
function enLargeTbox(a){
var cbobject= document.form1.elements(a)
cbobject.rows = 40
cbobject.cols = 30
}

function ReduceTbox(a){
var cbobject= document.form1.elements(a)
cbobject.rows = 4
cbobject.cols = 15
}
</script>
</form>
</body>

</html>

Edited 3 Years Ago by mike_2000_17: Fixed formatting

You are using very archaic javascript techniques

Either go with a cross browser javascript library (dojo, jquery, scriptaculous, mochikit, mootools )

or find a code that works "cross-browser"

I would go with the former, it takes a little bit of learning but you want have to think about browser incompatibilities anymore ....

This article has been dead for over six months. Start a new discussion instead.