|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
expected identifier errorsString.Append("document.forms[0]. + name + .style.visibility = 'hidden'" &
vbCrLf) The above is found in a function which has had name passed to it. This code is in the asp.net codebehind The name converts to card17 and would like code to look like this when converted: document.forms[0].card17.style.visibility = hidden Would appreciate any help thanks
Show quote
"barry" <flagi***@ix.netcom.com> wrote in Barry,news:usSwj$DCGHA.2704@TK2MSFTNGP15.phx.gbl: > sString.Append("document.forms[0]. + name + .style.visibility = > 'hidden'" & vbCrLf) > > The above is found in a function which has had name passed > to it. This code is in the asp.net codebehind > > The name converts to card17 and would like code to look like > this when converted: > > document.forms[0].card17.style.visibility = hidden > > Would appreciate any help > thanks sString.Append("document.forms[0]."); sString.Append(name); sString.Append(".style.visibility = 'hidden';"); sString.Append(vbCrLf); The problem Chris is that the sString.Append(name) gives an error about not
being declared Show quote "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message news:Xns97364F13BA6Fcrtimmonscrtimmonsin@207.46.248.16... > "barry" <flagi***@ix.netcom.com> wrote in > news:usSwj$DCGHA.2704@TK2MSFTNGP15.phx.gbl: > > > sString.Append("document.forms[0]. + name + .style.visibility = > > 'hidden'" & vbCrLf) > > > > The above is found in a function which has had name passed > > to it. This code is in the asp.net codebehind > > > > The name converts to card17 and would like code to look like > > this when converted: > > > > document.forms[0].card17.style.visibility = hidden > > > > Would appreciate any help > > thanks > > Barry, > > sString.Append("document.forms[0]."); > sString.Append(name); > sString.Append(".style.visibility = 'hidden';"); > sString.Append(vbCrLf); > > -- > Hope this helps. > > Chris. > ------------- > C.R. Timmons Consulting, Inc. > http://www.crtimmonsinc.com/ "barry" <flagi***@ix.netcom.com> wrote in Barry,news:ejlHF$KCGHA.2644@TK2MSFTNGP09.phx.gbl: > The problem Chris is that the sString.Append(name) gives an > error about not being declared What type is sString? Could you post more code that demonstrates the problem? Thanks. Chris. ------------- C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/ Chris here is the code. Basically it presents cards to the page and when I
click on a card I want it to become invisible. (line xx) I have not given you all the code that goes through numbering the cards etc. I have done a alert on the name parm and it does show the correct card being clicked on ----- but how to convert it so line xx accepts it is the problem. *********************************************************** Dim sString As System.Text.StringBuilder sString = New System.Text.StringBuilder sString.Append("<script language='Javascript'>" & vbCrLf) sString.Append("document.write(""<img class=setup") sString.Append(r) sString.Append(" src=../Solitary/images/") sString.Append(abc) sString.Append(" name=card") sString.Append(r + u) sString.Append(" id=card") sString.Append(r + u) sString.Append(" onclick=MakeInvisible(name)") sString.Append(" runat = server") sString.Append(">"");" & vbCrLf) sString.Append("function MakeInvisible(name) {" & vbCrLf) line xx sString.Append("(document.forms[0].name.style.visibility = 'hidden')" & vbCrLf) } sString.Append("</script>") *********************************************************** Show quote "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message news:Xns973695CC2C3C7crtimmonscrtimmonsin@207.46.248.16... > "barry" <flagi***@ix.netcom.com> wrote in > news:ejlHF$KCGHA.2644@TK2MSFTNGP09.phx.gbl: > > > The problem Chris is that the sString.Append(name) gives an > > error about not being declared > > Barry, > > What type is sString? Could you post more code that demonstrates the > problem? > > Thanks. > > Chris. > ------------- > C.R. Timmons Consulting, Inc. > http://www.crtimmonsinc.com/
Show quote
"barry" <flagi***@ix.netcom.com> wrote in Barry,news:epasGSNCGHA.3812@TK2MSFTNGP15.phx.gbl: > Chris here is the code. Basically it presents cards to the page > and when I click on a card I want it to become invisible. (line > xx) I have not given you all the code that goes through > numbering the cards etc. I have done a alert on the name parm > and it does show the correct card being clicked on ----- but > how to convert it so line xx accepts it is the problem. > > > *********************************************************** > Dim sString As System.Text.StringBuilder > sString = New System.Text.StringBuilder > > sString.Append("<script language='Javascript'>" & vbCrLf) > > sString.Append("document.write(""<img class=setup") > sString.Append(r) > sString.Append(" src=../Solitary/images/") > sString.Append(abc) > sString.Append(" name=card") > sString.Append(r + u) > sString.Append(" id=card") > sString.Append(r + u) > sString.Append(" onclick=MakeInvisible(name)") > sString.Append(" runat = server") > sString.Append(">"");" & vbCrLf) > > sString.Append("function MakeInvisible(name) {" & vbCrLf) > > line xx > sString.Append("(document.forms[0].name.style.visibility = > 'hidden')" & vbCrLf) } > sString.Append("</script>") > *********************************************************** So it's the browser's JavaScript that's raising the error, right? In that case, change line xx to call getElementById: sString.Append("document.getElementById(name).style.visibility = 'hidden'; }" & vbCrLf) Thank you so very much - that sure did the trick - I really appreciate your
time. Show quote "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message 'hidden'; }" & vbCrLf)news:Xns9736E60D9A039crtimmonscrtimmonsin@207.46.248.16... > "barry" <flagi***@ix.netcom.com> wrote in > news:epasGSNCGHA.3812@TK2MSFTNGP15.phx.gbl: > > > Chris here is the code. Basically it presents cards to the page > > and when I click on a card I want it to become invisible. (line > > xx) I have not given you all the code that goes through > > numbering the cards etc. I have done a alert on the name parm > > and it does show the correct card being clicked on ----- but > > how to convert it so line xx accepts it is the problem. > > > > > > *********************************************************** > > Dim sString As System.Text.StringBuilder > > sString = New System.Text.StringBuilder > > > > sString.Append("<script language='Javascript'>" & vbCrLf) > > > > sString.Append("document.write(""<img class=setup") > > sString.Append(r) > > sString.Append(" src=../Solitary/images/") > > sString.Append(abc) > > sString.Append(" name=card") > > sString.Append(r + u) > > sString.Append(" id=card") > > sString.Append(r + u) > > sString.Append(" onclick=MakeInvisible(name)") > > sString.Append(" runat = server") > > sString.Append(">"");" & vbCrLf) > > > > sString.Append("function MakeInvisible(name) {" & vbCrLf) > > > > line xx > > sString.Append("(document.forms[0].name.style.visibility = > > 'hidden')" & vbCrLf) } > > sString.Append("</script>") > > *********************************************************** > > Barry, > > So it's the browser's JavaScript that's raising the error, > right? In that case, change line xx to call getElementById: > > sString.Append("document.getElementById(name).style.visibility = Show quote > > -- > Hope this helps. > > Chris. > ------------- > C.R. Timmons Consulting, Inc. > http://www.crtimmonsinc.com/ |
|||||||||||||||||||||||