Guest valokettu Posted November 25, 2006 Share Posted November 25, 2006 The problem is this:I have a textarea and a button that is supposed to create text to that point on textarea, where users (text)cursor is. I didn't find any variable or function from DOM that could do it... Have you guys any ideas how I could do this?This is the best solution that I have invented, but it only adds text to the end. Not there where users cursor is...: <script language="javascript">function addlink() { document.saveform.teksti.value=document.saveform.text.value + "<a href='WRITE ADDRESS HERE' target=_blank>WRITE TEXT HERE</a>";}</script><form method=POST action="editor.php?page=save" name="saveform"><table cellspacing=0 cellpadding=5 border=1> <tr> <td> </td> <td><input type=button value="Create link" onClick="addlink();"></td> </tr> <tr> <td align=right>Text: </td> <td><textarea name="text" rows=6 cols=50></textarea></td> </tr> <tr> <td colspan=2 align=center><input type=submit value="Save"></td> </tr></table></form> Link to comment Share on other sites More sharing options...
Webworldx Posted November 26, 2006 Share Posted November 26, 2006 http://alexking.org/blog/2003/06/02/insert...ing-javascript/ 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