Код: Выделить всё
set t = document.all.item("MyItemID")
Модератор: Duncon
Код: Выделить всё
set t = document.all.item("MyItemID")
Код: Выделить всё
<form onSubmit="alert(document.getElementById(0)); return false">
<input id="1" name="td1" type="radio">t1
<input id="0" name="td2" type="radio">t2
<input id="0" name="td2" type="radio">t3
<input type="Submit" value="Send">
</form>
Код: Выделить всё
<script>
function check(fform){
for(i=0;i<5;i++)
checkElement(fform.elements['td'+i]);
}
function checkElement(elem){
if (elem.length!=null)
for(i=0;i<elem.length;i++)
alert(elem[i].value);
else
alert(elem.value);
}
</script>
<form onSubmit="check(this); return false">
<input id="0" name="td0" value="td0" type="radio" checked>t0
<input id="1" name="td1" value="td1" type="radio" checked>t1
<input id="2" name="td2" value="td2_1" type="radio" checked>t2
<input id="2" name="td2" value="td2_2" type="radio">t2
<input id="3" name="td3" value="td3" type="radio" checked>t3
<input id="4" name="td4" value="td4" type="radio" checked>t4
<input type="Submit" value="Send">
</form>
Код: Выделить всё
if (el.length = null)
if (el.length is Nothing)
Код: Выделить всё
If IsNull(el.length) Then
.........
.........
Else
.........
.........
End If
Код: Выделить всё
If Not IsNull(el.length) Then
.........
Код: Выделить всё
set labelcoll = document.all.item("notelabel")
' temporary resolution the the "element or collection" problem
CollLength = 0
On Error Resume Next
CollLength = labelcoll.length
On Error Goto 0
if (CollLength > 0) then
for i = 0 to CollLength - 1
labelcoll.item(i).style.backgroundcolor = UnSelectedBgColor
labelcoll.item(i).style.color = UnSelectedColor
next
else
labelcoll.style.backgroundcolor = UnSelectedBgColor
labelcoll.style.color = UnSelectedColor
end if
Код: Выделить всё
<html>
<body>
<script language="VBScript">
Sub testIT (name)
set labelcoll = document.getElementsByName(name)
for each itm in labelcoll
alert(itm.innerText)
next
End Sub
</script>
<div ID="label">
Label1
</div>
<div ID="label">
Label2
</div>
<div ID="anotherlabel">
Another Label
</div>
<form>
<input type="button" value="Go1" onClick="testIT('label')">
<input type="button" value="Go2" onClick="testIT('anotherlabel')">
<input type="button" value="Go3" onClick="testIT('nothing')">
</form>
</body>
</html>