87 | | } |
| 87 | // check if the className contains radiolist - if it's HORIZONTAL, then it won't match if we compare explicitly |
| 88 | } else if (elem.className.indexOf('radiolist') > -1) { |
| 89 | var cnt = elem.getElementsByTagName('li').length; |
| 90 | var idName = elem.id+'_'+cnt; |
| 91 | var newLi = document.createElement('li'); |
| 92 | var newLabel = document.createElement('label'); |
| 93 | var newText = document.createTextNode(' '+newRepr); |
| 94 | try { |
| 95 | // IE doesn't support settings name, type, or class by setAttribute |
| 96 | var newInput = document.createElement('<input type=\'radio\' name=\''+name.slice(3)+'\' checked=\'checked\' class=\''+elem.className+'\' />'); |
| 97 | } catch(err) { |
| 98 | var newInput = document.createElement('input'); |
| 99 | newInput.setAttribute('class', elem.className); |
| 100 | newInput.setAttribute('type', 'radio'); |
| 101 | newInput.setAttribute('name', name.slice(3)); |
| 102 | } |
| 103 | newLabel.setAttribute('for', idName); |
| 104 | newInput.setAttribute('id', idName); |
| 105 | newInput.setAttribute('value', newId); |
| 106 | newInput.setAttribute('checked', 'checked'); |
| 107 | newLabel.appendChild(newInput); |
| 108 | // check if the content being added is a tag - useful for image lists |
| 109 | if (newRepr.charAt(0) == '<' && newRepr.charAt(newRepr.length-1) == '>') { |
| 110 | newLabel.innerHTML += newRepr; |
| 111 | } |
| 112 | else { |
| 113 | newLabel.appendChild(newText); |
| 114 | } |
| 115 | newLi.appendChild(newLabel); |
| 116 | elem.appendChild(newLi); |
| 117 | } |