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>

Recommended Answers

All 2 Replies

Check the firefox javascript error console. It will tell you what error it sees.

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 ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.