Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cloneNode/removeChild no result in IE (7)

Status
Not open for further replies.

digibrill

Programmer
Dec 9, 2005
3
hello all, can anyone give me a hint as to why this (cloneNode and removeChild) is working in FF and not in IE? I've googled quite a bit, but no go. Thanks in advance.

Code:
function moveThis(proj,parSel,selNum){
    //alert(proj + "[" + parSel + "][" + selNum + "]");
    //alert(parSel);
    var myNewOpt = document.getElementById(proj + '[' + parSel + '][' + selNum + ']').cloneNode(true);
    alert('test');
    myNewOpt.setAttribute('ondblclick', 'document.getElementById("userProjs[' + parSel + '][]").removeChild(this);');
    document.getElementById('userProjs[' + parSel + '][]').appendChild(myNewOpt);
}

<select onchange="cdf(4)" id="Properties[4]" name="Properties[4]" size="5" title="Double-click to add projects to user" multiple="multiple">
<option value="Double-click" selected="selected">Dbl click below</option>
<option value="property1/" id="property1/[4][0]" name="property1/[4][0]" ondblclick="moveThis('property1/',4,0)">property1/</option>
<option value="property2/" id="property2/[4][1]" name="property2/[4][1]" ondblclick="moveThis('property2/',4,1)">property2/</option>
<option value="property3/" id="property3/[4][2]" name="property3/[4][2]" ondblclick="moveThis('property3/',4,2)">property3/</option>
<option value="property4/" id="property4/[4][3]" name="property4/[4][3]" ondblclick="moveThis('property4/',4,3)">property4/</option>
<option value="On Broadway/" id="On Broadway/[4][4]" name="On Broadway/[4][4]" ondblclick="moveThis('On Broadway/',4,4)">On Broadway/</option></select>

<select onchange="cdf(4)" id="userProjs[4][]" name="userProjs[4][]" size="5" title="Double-click to remove projects" multiple="multiple">
<option value="property1/" selected="selected" ondblclick="document.getElementById('userProjs[4][]').removeChild(this);">property1/</option>
<option value="property2/" selected="selected" ondblclick="document.getElementById('userProjs[4][]').removeChild(this);">property2/</option>
</select>
  <input id='sendReminder[4]' name='sendReminder[4]' title='Send user password reminder' value='test@test.com&dvbz777' type='checkbox' />
  <input id='d_e_l_e_t_e[4]'  name='d_e_l_e_t_e[4]' title='Delete this user completely' type='checkbox'  />
 
My advice is to remove the 'ondblclick' handler from each option and put the code in the 'onchange' handler on the select element itself.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top