Attributes.add problem

Discussion in 'ASP .Net' started by David Wier, Jul 24, 2005.

  1. David Wier

    David Wier Guest

    I'm trying to assign the results of a variable in ASP.Net to a button's
    onclick event (a Javascript function) - -

    The Javascript function is:
    function OpenIt(NewWindow) {

    flyout=window.open(NewWindow,"flyout","resizable=no,scrollbars=no,width=755,
    height=550,scrollbars=1,top=100,left=100")
    }

    Then, I add this to the the routine that returns the URL
    btnvideo.attributes("onclick")="OpenIt('<%#sURL %>');"

    If I don't include the single quotes, it just tells me it's a syntax
    error - - which doesn't really help -

    the generated html is:
    <input type="submit" name="btnvideo" value="Get Video" id="btnvideo"
    onclick="OpenIt('<%# sURL %>');" />

    Any ideas on how to get this working?
     
    David Wier, Jul 24, 2005
    #1
    1. Advertisements

  2. David Wier

    Guest Guest

    Is this part:
    btnvideo.attributes("onclick")="OpenIt('<%#sURL %>');"

    happening on the server side, say in Page load?

    If so, you don't need the <% %> rather just your sURL

    Like this:
    btnvideo.attributes("onclick")="OpenIt(" + sURL + ");"

    Is that it? More of the code would help.
     
    Guest, Jul 24, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.