ajoo
Programmer
- Jun 26, 2008
- 3
Hi,
I need to write a java script: Here is what it should do, when user will click on the add button it will copy the add the selected value into input field seperated by comma(,). If the input field already has some name the selected name(s) will be added to the existing value of input field
Thanks
<html>
<head>
<title>Test</title>
</head>
<body>
<tr>
<td><strong>name</strong></td>
<td colspan="3"><input type="text" size="50" name="fName" value=""/></td>
<td colspan="3">
<INPUT TYPE=BUTTON VALUE="Add <<" ONCLICK="copySelectedOptions('UserList')">
</td>
<td>
<SELECT MULTIPLE="MULTIPLE" NAME="UserList" SIZE="5" WIDTH=100 id="UserList">
<OPTION value="abrahast">abrahast</OPTION>
<OPTION value="abreura">abreura</OPTION>
<OPTION value="chris">chris</OPTION>
<OPTION value="john">john</OPTION>
<OPTION value="Ravi Tandon">Ravi Tandon</OPTION>
</SELECT>
</td>
</tr>
<br>
<br>
<br>
<tr>
<td>
<input type="button" name="B2" value="Save" onClick="test()">
</td>
</tr>
</body>
</html>
I need to write a java script: Here is what it should do, when user will click on the add button it will copy the add the selected value into input field seperated by comma(,). If the input field already has some name the selected name(s) will be added to the existing value of input field
Thanks
<html>
<head>
<title>Test</title>
</head>
<body>
<tr>
<td><strong>name</strong></td>
<td colspan="3"><input type="text" size="50" name="fName" value=""/></td>
<td colspan="3">
<INPUT TYPE=BUTTON VALUE="Add <<" ONCLICK="copySelectedOptions('UserList')">
</td>
<td>
<SELECT MULTIPLE="MULTIPLE" NAME="UserList" SIZE="5" WIDTH=100 id="UserList">
<OPTION value="abrahast">abrahast</OPTION>
<OPTION value="abreura">abreura</OPTION>
<OPTION value="chris">chris</OPTION>
<OPTION value="john">john</OPTION>
<OPTION value="Ravi Tandon">Ravi Tandon</OPTION>
</SELECT>
</td>
</tr>
<br>
<br>
<br>
<tr>
<td>
<input type="button" name="B2" value="Save" onClick="test()">
</td>
</tr>
</body>
</html>