da_cracken Posted September 4, 2006 Share Posted September 4, 2006 Hi, I need help please. I'm working on a script to paste items into a text area. The scipt pastes, but it pastes where it wants to paste, and not where i want it to go. I want it to paste at the text selector, but it only pastes at the very end of any text already in the box. I have pasted a small part of the script below and I pray someone can figure out the error of my ways for me ;Dfunction BR(){document.Pro.write.value += ("<BR>\n")} Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Because that is what you are telling it do. The += adds whats on the right to the end of whats on the left. So its always going to add [nobbc]<br>[/nobbc] on to the end of whats in you textareaIf you want to get javascript to add [nobbc]<br>[/nobbc] where your curser is, then it'll be a bit more advanced as you'll have to use javascript find out where the curser is located to and then get it to add br tag in that location.Also whay are you adding br tag into a textarea anyway? If its to preserver line breaks. Dont bother just use the nl2br PHP function to preserve the line breaks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.