roxii
04-19-2005, 08:07 PM
Ok, I've given up on the insert text at carat idea, it seems to be impossible cross browser. I decided I will focus on getting help for this problem then.
How do I get a link to insert text in the textbox that was last focused upon?
<form name="form1" action="">
<textarea name="textarea1" onfocus="focus(this)"></textarea>
<textarea name="textarea2" onfocus="focus(this)"></textarea>
<a href="javascript:insert('<img src="picture1.gif" alt="picture1.gif">')">picture1.gif</a>
</form>
I'm no great shakes at writing javascript. Everything I've tried for this fails, but what I think it needs would be a simple function 'focus' that knows what textarea was last focused on. Then when you click on the link 'picture1.gif', it runs the second function 'insert' that sticks '<img src="picture1.gif" alt="picture1.gif">' into the last focused upon textarea.
That sound right? Would anyone be so kind as to help me out with the javascript portion of it?
How do I get a link to insert text in the textbox that was last focused upon?
<form name="form1" action="">
<textarea name="textarea1" onfocus="focus(this)"></textarea>
<textarea name="textarea2" onfocus="focus(this)"></textarea>
<a href="javascript:insert('<img src="picture1.gif" alt="picture1.gif">')">picture1.gif</a>
</form>
I'm no great shakes at writing javascript. Everything I've tried for this fails, but what I think it needs would be a simple function 'focus' that knows what textarea was last focused on. Then when you click on the link 'picture1.gif', it runs the second function 'insert' that sticks '<img src="picture1.gif" alt="picture1.gif">' into the last focused upon textarea.
That sound right? Would anyone be so kind as to help me out with the javascript portion of it?