Attributes.add problem

D

David Wier

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?
 
G

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top