Javascript problem.. works fine on firefox but not on explorer :\\

I am trying to make a comments system like in Facebook.
Its suppose to expend the textbox dynamically.
and show the “Share” button only if something is written in the text box…
now my problem is that on firefox it works great.
but on explorer it doesn’t expend the text box or showing the share button…
What is the problem?

The Code:


document.getElementById('comments').addEventListener('keyup', function () { = 0; // this is necessary to make it shrink when deleting = this.scrollHeight + 'px';
}, false);

function ShowButton(check)
	if (check == 1)
		document.getElementById('Share').type = "submit";
		document.getElementById('Share').type = "hidden";

the section of code on share.php

						<td colspan="2">
							<form action="" method="post">
							<textarea id ="comments" name="comments" style="width: 400px;,font-size: 16px;line-height: 1; height: 16px;" onFocus="if(this.value == 'Write something...') {this.value = ''; ShowButton(1);}" onBlur="if (this.value == '') {this.value = 'Write something...'; ShowButton(0);}">Write something...</textarea>
							<div align=right>
								<input id="Share" type="hidden" value="Share" class="SearchButton"  style="width:50px; height:20px; border-width:0px;"/>

“addEventListener” can not be used in ie.

use “attachEvent” for ie.

IE doesn’t allow you to change the type after it has first been assigned. You need to delete the entire input tag and recreate it if you want to change the type in IE.

Take a look at Self Labelling Password Fields where I have an example of how to do this which switches between type=“text” and type=“password”. The code to change between type=“submit” and type=“hidden” would be similar.