Forum Moderators: open

Message Too Old, No Replies

Textarea not working in IE

works in firefox

         

gameoverload

10:11 pm on Dec 23, 2009 (gmt 0)

10+ Year Member



I am currently implementing an "add this to your page" feature on my site. Each game has an external .js and iframe option. When you click in the textarea it should highlight all the code, in firefox both textarea's highlight, in IE only the iframe code does


<script type="text/javascript">
function SelectAll(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}
</script>
<b><A NAME="help">help</A></b><br>
<b><A NAME="angular_momentum">Angular Momentum</A></b><br>
<A HREF="#help">Help With Embed Code</A><br>
<textarea id="angular_momentum" onClick="SelectAll('angular_momentum');" style="width:100%; height:20px;" >
<script type="text/javascript" src="http://-----.com/embed/angular_momentum.js"></script>
</textarea><br>
<textarea id="angular_momentum_frame" onClick="SelectAll('angular_momentum_frame');" style="width:100%; height:20px;" >
<iframe src="http://-----.com/embed/frame/?game=angular_momentum" width="550px" height="440px"></iframe>
</textarea>
<b><A NAME="assembler">Assembler</A></b><br>
<A HREF="#help">Help With Embed Code</A><br>
<textarea id="assembler" onClick="SelectAll('assembler');" style="width:100%; height:20px;" >
<script type="text/javascript" src="http://-----.com/embed/assembler.js"></script>
</textarea>
<textarea id="assembler_frame" onClick="SelectAll('assembler_frame');" style="width:100%; height:20px;" >
<iframe src="http://-----.com/embed/frame/?game=assembler" width="550px" height="400px"></iframe>
</textarea>

I have blocked out my site name with -----,

Any help is appreciated!

dreamcatcher

9:58 am on Dec 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi gameoverload,

You should escape any tags inside the textarea tags:


<textarea id="angular_momentum_frame" onClick="SelectAll('angular_momentum_frame');" style="width:100%; height:20px;" >
&lt;iframe src="http://-----.com/embed/frame/?game=angular_momentum" width="550px" height="440px"&gt;&lt;/iframe&gt;
</textarea>

dc

gameoverload

4:54 pm on Dec 26, 2009 (gmt 0)

10+ Year Member



Is there any other way to give code to my visitors if a textbox wont work?

dreamcatcher

12:28 am on Dec 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try looking into some of the JQuery plugins for copying data to the clipboard:

[google.co.uk...]

dc