WebDesignChat
 
Partners
Web Design Resources
Web Designers Directory
Html Help
WPDFD
Tip Tricks
Page Resource
Design Companies
Website Design
Ceonex Web Design
LevelTen Design
Web Designing
Resources
Web Hosting Reviews
Free Design Stuff
Free Fonts
Free Graphics
Stylesheet Editor
Web Editor
Form Mail Script
Free Search Engine Submission
Photoshop Tutorials
Advertise Here
Welcome to WebDesignChat.org. Web Design chat is a one stop place to chat about all the latest happenings going in web design field. Here you can increase your knowledge as well as help others to grow their knowledge on Web Designing.


Go Back   Web Design Forum > Web Programming > Javascript and Html
User Name
Password
Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-15-2007, 11:04 AM
w_developer w_developer is offline
Junior Member
 
Join Date: Jul 2007
Posts: 3
Default HTML form and Javascript Urgent Help needed

HI,

I just want to make a form where I have a selection list and a text box.
Now, the selection list box contains smileys like :---), :---(, ;---) etc.

What I want to do is type in text in the text box like
hello
Now if I select :---) from drop down box it should be displayed as
hello :---) in the text box
Now I should be able to continue writing in the text box
hello :---) sorry and then again select another option from drop down
like for example
hello :---) sorry :---(
These symbols (:---),:---( should come from the drop down select list)
I m using this script >

<body>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--

function put_it()
{
var w = document.myform.sel_list.selectedIndex;
document.myform.r_text.value =
document.myform.sel_list.options[w].text;
}

//-->
</SCRIPT>
<FORM NAME="myform">
<SELECT NAME="sel_list" onclick="put_it()" SIZE="3">
<OPTION VALUE="value1">:---)
<OPTION VALUE="value2">:---(
<OPTION VALUE="value3">;---)
<OPTION VALUE="value4">:---)
<OPTION VALUE="value5">:---(
</SELECT>
<BR>
<INPUT TYPE="TEXT" VALUE="" NAME="r_text" SIZE="20">
</FORM>
</body>

------------------------------------------------------------

The problem is that every time I select from the drop down list the text box refreshes and the typed in text is lost.

Please suggest what change shall I make to this script.

Also, I want to do same thing by having images of icons on my page and similarly when some clicks on the image the corresponding symbol like for smiling face :---) gets inserted into text box. Plzzz suggest how can I do this!...thanks a ton

Please reply sooon!
Reply With Quote
Sponsored Links
  #2  
Old 07-15-2007, 12:38 PM
w_developer w_developer is offline
Junior Member
 
Join Date: Jul 2007
Posts: 3
Default Thanks I got the solution!

here is the correct script >
<html>
<body>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--


function put_it()

{
var w = document.myform.sel_list.selectedIndex;
document.myform.r_text.value =
document.myform.r_text.value+document.myform.sel_l ist.options[w].text;
}

//-->
</SCRIPT>
<FORM NAME="myform">
<SELECT NAME="sel_list" onclick="put_it()" SIZE="3">
<OPTION VALUE="value1">The First Item
<OPTION VALUE="value2">The Second Item
<OPTION VALUE="value3">The Third Item
<OPTION VALUE="value4">The Fourth Item
<OPTION VALUE="value5">The Fifth Item
</SELECT>
<BR>
<INPUT TYPE="TEXT" VALUE="" NAME="r_text" SIZE="20">
</FORM>
</body>
</html>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




All times are GMT. The time now is 01:03 AM.
Powered by: vBulletin Version 3.0.3

Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.