vytas Posted February 19, 2007 Share Posted February 19, 2007 Ok this code works in IE but not in Opera . <script type="text/javascript">function lol()var r= document.getElementById('innhold').valuedocument.getElementById('innhold').innerHTML=r+"[ code]Code[ /code]";}</script><a href="java script:lol()">Click here</a><br />Content<br /><textarea cols='70' rows='10' id='innhold' name='innhold'></textarea> Could some1 help me figure this outEDIT: If some1 doesn't know what this code does, it adds [ code]Code[ /code] to a textarea Link to comment Share on other sites More sharing options...
aspnetguy Posted February 19, 2007 Share Posted February 19, 2007 use .value instead of .innerHTML instead and it should work in both. Link to comment Share on other sites More sharing options...
vytas Posted February 19, 2007 Author Share Posted February 19, 2007 Yea thx it works . Link to comment Share on other sites More sharing options...
aspnetguy Posted February 19, 2007 Share Posted February 19, 2007 you are supposed to use .value because a textarea is essentially the same as <input> you just place a closing tag. IE executes wrong code and tries to guess what you meant while other browsers just don't execute the wrong (which what should happen). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now