Executing Javascript from a web toolbar button

Discussion in 'ASP .Net' started by John, Aug 15, 2004.

  1. John

    John Guest

    Hi all,

    I have a web toolbar and a few buttons on it. On one of the buttons, I need
    to execute some Javascript. I did put <span
    onclick="Javascript:alert('test');"></span> in the text property but this
    does not work.

    How can I execute some Javascript from one of these buttons?

    Regards
    John.
    John, Aug 15, 2004
    #1
    1. Advertising

  2. Hi,
    I tried the same code ( SPAN tag on click), it works fine. can u post the
    exact
    code, so we can get a clear picture.

    Thanks,
    Senthil.
    "John" wrote:

    > Hi all,
    >
    > I have a web toolbar and a few buttons on it. On one of the buttons, I need
    > to execute some Javascript. I did put <span
    > onclick="Javascript:alert('test');"></span> in the text property but this
    > does not work.
    >
    > How can I execute some Javascript from one of these buttons?
    >
    > Regards
    > John.
    >
    >
    >
    =?Utf-8?B?U2VudGhpbCBLdW1hcg==?=, Aug 16, 2004
    #2
    1. Advertising

  3. John

    John Guest

    Hi Senthil,

    Here is the code:
    Dim override As Microsoft.Web.UI.WebControls.ToolbarButton =
    toolClaim.Items.Item(2)

    override.ImageUrl = Session("ImagePath") & "override.jpg"

    override.ToolTip = "Override"

    override.Text = "<span onclick=""alert('Tester');""></span>"





    Now the ImageURL as well as the ToolTip is working fine. I can see the span
    section if I 'view source' on the html page but it doesn't execute. I know
    it's not security settings since I have alerts that work throughout my app.

    Any help appreciated . . .

    Regards
    John.


    "Senthil Kumar" <Mindtree Consulting, India> wrote in message
    news:...
    > Hi,
    > I tried the same code ( SPAN tag on click), it works fine. can u post

    the
    > exact
    > code, so we can get a clear picture.
    >
    > Thanks,
    > Senthil.
    > "John" wrote:
    >
    > > Hi all,
    > >
    > > I have a web toolbar and a few buttons on it. On one of the buttons, I

    need
    > > to execute some Javascript. I did put <span
    > > onclick="Javascript:alert('test');"></span> in the text property but

    this
    > > does not work.
    > >
    > > How can I execute some Javascript from one of these buttons?
    > >
    > > Regards
    > > John.
    > >
    > >
    > >
    John, Aug 16, 2004
    #3
  4. John

    Ryden Guest

    Try this instead:

    override.ImageUrl = Session("ImagePath") & "override.jpg"

    override.ToolTip = "Override"

    'override.Text = "<span onclick=""alert('Tester');""></span>"

    override.Attributes("onclick") = "alert('Tester');"

    override.onClick is the ASP event, wherea
    override.Attributes("onclick") is the tag attribute usable t
    JavaScript

    This is a much cleaner approac


    -
    Ryde
    -----------------------------------------------------------------------
    Posted via http://www.codecomments.co
    -----------------------------------------------------------------------
    Ryden, Sep 7, 2004
    #4
    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. Ashish
    Replies:
    2
    Views:
    927
    Ashish
    Feb 22, 2004
  2. John

    Web Toolbar button problem

    John, Aug 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    301
  3. Jim Mitchell
    Replies:
    0
    Views:
    190
    Jim Mitchell
    Jul 12, 2003
  4. Ashish

    how to attach javascript to toolbar button control

    Ashish, Feb 22, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    160
    Marshal Antony
    Feb 22, 2004
  5. pcouas
    Replies:
    0
    Views:
    242
    pcouas
    Feb 19, 2007
Loading...

Share This Page