I have the below code with java script. There is a Pull down menu and Text Box, when i select any item from pull down menu, the same value copies in the Text Box. But the Problem is tha when i put the Action form behind these form fields, This script never works I dont know why?? If anyone Knows Some other Technics please tell me.
Please help me in this regards as soon as possible, I would be very much thankfull to you.
Thanks.
Abdul Jabbar
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style></style>
<script language="JavaScript">
<!-- Begin
catnumber = 3
offset = 150
performOnchange = false
if (document.all) {
docObj = "document.all."
styleObj = ".style"
} else {
docObj = "document."
styleObj = ""
}
function closeselect2(submenu,subcat){
popupselect = eval(docObj + subcat + styleObj)
if (submenu.selectedIndex != 0) {
popupselect.visibility = "visible"
numchoice = submenu.selectedIndex
choice = submenu[numchoice].value
data2.value = choice
submenu.selectedIndex = 0
}
}
function closeselect3(submenu,subcat){
popupselect = eval(docObj + subcat + styleObj)
if (submenu.selectedIndex != 0) {
popupselect.visibility = "visible"
numchoice = submenu.selectedIndex
choice = submenu[numchoice].value
data3.value = choice
submenu.selectedIndex = 0
}
}
function lock() {
performOnchange = false
}
function unlock() {
performOnchange = true
}
function selectSub(cat) {
for (i=1; i <= catnumber; i++) {
subcat = "sub" + i
popupselect = eval(docObj + subcat + styleObj)
popupselect.visibility = "visible"
}
if (performOnchange == true) {
letsopen = "sub" + cat.selectedIndex
if (letsopen == "sub0") {
alert("No category selected")
choice = "- subcategory -"
subcategory.value = choice
cat.focus()
} else {
openselect(letsopen)
lock()
}
}
}
// End -->
</script>
</head>
<body>
<!-- TWO STEPS TO INSTALL CATEGORY SELECTION:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<div align="center">
<div id="sub2"> </div>
<div id="sub3"> </div>
</div>
<p>
<center>
</center>
<p>
<!-- Script Size: 3.41 KB -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" height="30"> </td>
<td width="33%"><select name="subarts" onChange="closeselect2(this,'sub2')">
<option value="" selected>MENU 1</option>
<option value="music">music </option>
<option value="lyrics">lyrics </option>
<option value="painting">painting </option>
</select></td>
<td width="34%"><select name="subsoftware" onChange="closeselect3(this,'sub3')">
<option value="" selected>MENU 2</option>
<option value="php">php </option>
<option value="java">java </option>
<option value="asp">asp </option>
<option value="mysql">mysql </option>
</select></td>
</tr>
<tr>
<td height="52"> </td>
<td> <input name="data2" type="text" id="data2" value="- subcategory -">
</td>
<td><input name="data3" type="text" id="data3" value="- subcategory -"></td>
</tr>
</table>
<br>
<br>
</body>
</html>