Do forms effect the way that elements are referenced in VB script?
The following piece of code seems to work OK:-
<SCRIPT language=VBScript>
Sub NoFormDown()
imgNoForm.src = "Images/UpdateDown.gif"
paraTest.innerText = Now()
End Sub
Sub NoFormUp()
imgNoForm.src = "Images/Update.gif"
paraTest.innerText = Now()
End Sub
</SCRIPT>
<P>
<INPUT type=image src="Images/Update.gif" border=0 name="Jim"
OnMouseDown='NoFormDown()' OnMouseUp='NoFormUp()' ID=imgNoForm>
</P>
However, none of the 3 attempts to reference the <INPUT> element, seem to
work in the following piece of code
<SCRIPT language=VBScript>
Sub WithFormDown()
frmTest.elements("imgWithForm").src = "Images/UpdateDown.gif"
frmTest.imgWithForm.src = "Images/UpdateDown.gif"
imgWithForm.src = "Images/UpdateDown.gif"
paraTest.innerText = Now()
End Sub
Sub WithFormUp()
imgWithForm.src = "Images/Update.gif"
paraTest.innerText = Now()
End Sub
</SCRIPT>
<P>
<FORM action="Example.htm" method=get ID=frmTest>
<INPUT type=image src="Images/Update.gif" border=0 name="Fred"
OnMouseDown='WithFormDown()' OnMouseUp='WithFormUp()' ID=imgWithForm>
</FORM>
</P>
The only change is the <INPUT> element is now wrapped inside the <FORM>
element. How do you reference elements that are in forms?
Thanks for any help given.
--
Steve Walton