expected identifier error

Discussion in 'ASP .Net' started by barry, Dec 24, 2005.

  1. barry

    barry Guest

    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, Dec 24, 2005
    #1
    1. Advertising

  2. "barry" <> wrote in
    news:usSwj$:

    > 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/
    Chris R. Timmons, Dec 24, 2005
    #2
    1. Advertising

  3. barry

    barry Guest

    The problem Chris is that the sString.Append(name) gives an error about not
    being declared

    "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
    news:Xns97364F13BA6Fcrtimmonscrtimmonsin@207.46.248.16...
    > "barry" <> wrote in
    > news:usSwj$:
    >
    > > 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, Dec 24, 2005
    #3
  4. "barry" <> wrote in
    news:ejlHF$:

    > 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/
    Chris R. Timmons, Dec 24, 2005
    #4
  5. barry

    barry Guest

    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>")
    ***********************************************************



    "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
    news:Xns973695CC2C3C7crtimmonscrtimmonsin@207.46.248.16...
    > "barry" <> wrote in
    > news:ejlHF$:
    >
    > > 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/
    barry, Dec 24, 2005
    #5
  6. "barry" <> wrote in
    news::

    > 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/
    Chris R. Timmons, Dec 25, 2005
    #6
  7. barry

    barry Guest

    Thank you so very much - that sure did the trick - I really appreciate your
    time.

    "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
    news:Xns9736E60D9A039crtimmonscrtimmonsin@207.46.248.16...
    > "barry" <> wrote in
    > news::
    >
    > > 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/
    barry, Dec 25, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Stiff

    Error: <identifier> expected

    Robert Stiff, Nov 5, 2003, in forum: Java
    Replies:
    2
    Views:
    8,473
    Harald Hein
    Nov 6, 2003
  2. Kobu
    Replies:
    7
    Views:
    440
  3. Replies:
    2
    Views:
    1,738
  4. Replies:
    2
    Views:
    883
    Owen Jacobson
    Dec 11, 2007
  5. S_K
    Replies:
    0
    Views:
    644
Loading...

Share This Page