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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable object name

Status
Not open for further replies.

LinuxKommy

Technical User
Apr 2, 2002
31
US
This may be a stupid question, but I'm trying to use a variable in an object name, how would i do this? I have buttons named Length1, Length2, etc. and their onclick event is LD(1), LD(2), etc., respetively. my code is posted below. any help woulld be greatly appreciated.

Douglas
Code:
<script language=&quot;VBScript&quot;>
Sub LD(j)
document.form1.Length .Value=456
' j needs to go here ^

document.form1.submit
end sub
</script>
 
cant you pass a sub an object

the sub you pass it to knows what type of object has been passed so...

Sub doSth(objPassed)

objPassed.Name = &quot;helloworld&quot;
'or
objPassed.Visible = True
'or
objPassed.Height = 110

End Sub
 
Rydel,

thanks for the reply, but there will be a variable number of objects...i had thought about the SELECT CASE statement, but it wouldn't work.

mrmovie,
your reply seems to be working, but i'll also need to pass three variables with it. This program is for loading things onto a trailer...what the sub LD does is lay the tank down...so Height, width, and length need to be passed.

will <input type=&quot;button&quot; onClick=&quot;LD(Length1,Width1,Height1)&quot;>
also work and just have the sub pick up all three?

thanks again (to both of you) for your speedy replies
Douglas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top