Home All Groups Group Topic Archive Search About

expected identifier error

Author
24 Dec 2005 4:09 AM
barry
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

Author
24 Dec 2005 6:30 AM
Chris R. Timmons
Show quote
"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/
Author
24 Dec 2005 5:30 PM
barry
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/
Author
24 Dec 2005 8:43 PM
Chris R. Timmons
"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/
Author
24 Dec 2005 9:53 PM
barry
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/
Author
25 Dec 2005 4:38 AM
Chris R. Timmons
Show quote
"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 = 'hidden'; }" & vbCrLf)

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Author
25 Dec 2005 5:10 AM
barry
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
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 =
'hidden'; }" & vbCrLf)
Show quote
>
> --
> Hope this helps.
>
> Chris.
> -------------
> C.R. Timmons Consulting, Inc.
> http://www.crtimmonsinc.com/

AddThis Social Bookmark Button