Jump to content


Photo

javascript insert into textarea question


  • Please log in to reply
1 reply to this topic

#1 n8w

n8w
  • Members
  • PipPipPip
  • Advanced Member
  • 123 posts

Posted 28 March 2006 - 11:01 PM

javascript insert into textarea question
can anyone tell me or point me to some information for the following:

I want to create a javascript function that inserts text into the textarea of a form .. which is easy .. but how do I create it for a series of steps

for example ...

I want it to work just like the insert link for this editor .. where you click insert link .. it asks for the link .. then the name of the link and then inserts the code into the text area

thanks
n8w

#2 GBS

GBS
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 19 April 2006 - 10:18 PM

Hi there,

If I get it,, maybe something like that could help you,
<html>
<script>
function DoTheJob()
{    
    var message = "Waiting for some values,,";
    var return_value = prompt(message,"");

document.getElementById('my_text_area').value=return_value;
document.getElementById('my_text_area').style.visibility="visible";
}
</script>

<body>

<input type="button" value="Hello the world" onclick="DoTheJob()">

<textarea rows="2" cols="20"  id="my_text_area"></textarea>

<script>
// just to init the old values for firefox
document.getElementById('my_text_area').value="";
// & to hide the textarea part
document.getElementById('my_text_area').style.visibility="hidden";
</script>

</body>
</html>


Hoping it will help,,

l8tr,,
Sorry for my english,... I do my best, but sometimes,...
1st intention: understand the problem
2nd intention: try to solve it
3rd intention: try to understand how to solve it :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users