[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

textareas...

Posted on 2002-06-03
11
Medium Priority
?
287 Views
Last Modified: 2010-04-09
i want to be able to insert a variable into a textarea exactly starting where the cursor is in the textarea...


at the moment i have

document.forms.myform.textareaname.value = document.forms.myform.textareaname.value + "anything";

this adds it to the end of the string in the textarea
but i want "anything" to appear whereever the cursor is...

any ideas?
0
Comment
Question by:n1875621
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 2

Expert Comment

by:chops123
ID: 7050638
Try this out...

=================================================
<script>
function stockLinkIn() {
document.forms.myform.S1.value = "anything"
}

function stockLinkOut() {
document.forms.myform.S1.value = "Nothing"
//document.forms.myform.S1.value = document.forms.myform.S1.value + "anything";

}
</script>

<form method="POST" name="myform" action="--WEBBOT-SELF--">
  <textarea onMouseDown="stockLinkIn()" onMouseUp="stockLinkOut()" rows="2" name="S1" cols="20"></textarea><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2">
</form>
=================================================

This will change the contents of the textarea when you click on the text area.

You can have various events onMouseDown(),onMouseUp(),onMouseOver(),onMouseOut() on which you can change the text in the text area

Hope this helps

Rgds
KC
0
 

Author Comment

by:n1875621
ID: 7050785
im not after adding content to the textarea on mouse events... i am after changing the content depending on where the cursor is in the text area....

for example....

if my cursor is the pipe '|' symbol... i want to change this...


"this is the content | where and the pipe symbol is where i want to add text"

to this

"this is the content 'and this is what has to be added'| where and the pipe symbol is where i want to add text"

is that clear as mud ?

0
 

Author Comment

by:n1875621
ID: 7050786
im not after adding content to the textarea on mouse events... i am after changing the content depending on where the cursor is in the text area....

for example....

if my cursor is the pipe '|' symbol... i want to change this...


"this is the content | where and the pipe symbol is where i want to add text"

to this

"this is the content 'and this is what has to be added'| where and the pipe symbol is where i want to add text"

is that clear as mud ?

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7050826
0
 

Author Comment

by:n1875621
ID: 7050831
this example only shows how to append to a text area... which i can do - i want to insert into a text area where the cursor is located
0
 
LVL 2

Accepted Solution

by:
jsmckenzie earned 200 total points
ID: 7054280
0
 
LVL 18

Expert Comment

by:bruno
ID: 7146394

Hello,

This question has been open for quite a while now and needs to be wrapped up.

EXPERTS: If any of the experts could come back and post any suggestions as to how they feel this could be wrapped up (delete, 0 PAQ, award points, etc), I'm sure the moderators would appreciate it.  If you feel you deserve points here, but don't care to respond, the question might very well get DELETED.

ASKER:  Please return and finalize this question.  Abandoning a question is in violation of the member agreement.

Please do NOT accept this comment as an answer, as I am simply trying to alert those involved that the question is still open.

Thank you,

BRUNO
0
 
LVL 2

Expert Comment

by:jsmckenzie
ID: 7146445
I did a search and found a PAQ with similar information, so I suppose this one could be deleted.  I'd be interested to hear if the problem was solved.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7146574
A delete works for me.  There is already simialr in the PAQ so there is no value in PAQing it.

Cd&

0
 
LVL 2

Expert Comment

by:chops123
ID: 7146977
well.. i thot this question was dead.. anyways..delete it.

KC
0
 
LVL 18

Expert Comment

by:bruno
ID: 7154534
n1875621,

why would you possibly "accept a comment as answer" and then only give it a C?

That shows an incredible lack of respect for the experts.  If the answer wasn't good enough to warrant at least an A or B, it should not have been accepted.

I suggest you contact Community Support (link on the left) and ask them to resolve this issue, lest the quality of help you recieve on this site decline in the future.



BRUNO
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question