Ive a problem parentlist script.
[HTML]<select size="8" name="parentList" multiple>
</select><a href="#stay" onclick = "javascript:small_window('modify.asp');" ><font size="2">add</font></a><font size="2">|</font><a href="#stay" onclick = "javascript:deleteSelectedItemsFromList(parentList );"><font size="2"> Remove</font></a>
[/HTML]
and modify.asp
Expand|Select|Wrap|Line Numbers
- <script language="JavaScript">
- Begin
- <!--
- // Add the selected items in the parent by calling method of parent
- function addSelectedItemsToParent() {
- self.opener.addToParentList(window.document.forms[0].destList);
- window.close();
- }
- // Fill the selcted item list with the items already present in parent.
- function fillInitialDestList() {
- var destList = window.document.forms[0].destList;
- var srcList = self.opener.window.document.forms[0].parentList;
- for (var count = destList.options.length - 1; count >= 0; count--) {
- destList.options[count] = null;
- }
- for(var i = 0; i < srcList.options.length; i++) {
- if (srcList.options[i] != null)
- destList.options[i] = new Option(srcList.options[i].text);
- }
- }
- // Add the selected items from the source to destination list
- function addSrcToDestList() {
- destList = window.document.forms[0].destList;
- srcList = window.document.forms[0].srcList;
- var len = destList.length;
- for(var i = 0; i < srcList.length; i++) {
- if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
- //Check if this value already exist in the destList or not
- //if not then add it otherwise do not add it.
- var found = false;
- for(var count = 0; count < len; count++) {
- if (destList.options[count] != null) {
- if (srcList.options[i].text == destList.options[count].text) {
- found = true;
- break;
- }
- }
- }
- if (found != true) {
- destList.options[len] = new Option(srcList.options[i].text);
- len++;
- }
- }
- }
- }
- // Deletes from the destination list.
- function deleteFromDestList() {
- var destList = window.document.forms[0].destList;
- var len = destList.options.length;
- for(var i = (len-1); i >= 0; i--) {
- if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
- destList.options[i] = null;
- }
- }
- }
- // End -->
</p>
</head>
<body onLoad="javascript:fillInitialDestList();">
<select size="10" name="srcList" multiple>
<option value="1">1
<option value="2">2
<option value="3">3
</select>
<input type="button" value=" >> " onClick="javascript:addSrcToDestList()">
<input type="button" value=" << " onclick="javascript:deleteFromDestList();">
<input type="button" value="Add" onClick = "javascript:addSelectedItemsToParent()">
[/HTML]
this code is working with mozilla. But not explorer.
and this pictures.
Mozilla
Explorer
thanks...