javascript in the code-behind

hi,

How can write the following javascript function in the code-behind and and execute? I want to execute the function when I click a button.

function load(menu) {
  if (window.dialogArguments && dialogArguments.location) {
    dialogArguments.location.href = "mypage.aspx?id=1";   //maybe you have to put the full address here
    window.close();
  }
}

onClick="load(this.form.menu)"

ayha
LVL 7
ayha1999Asked:
Who is Participating?
 
KelevraConnect With a Mentor Commented:
Hi,
have a look there maybe this will help!

http://msdn.microsoft.com/fr-fr/library/ms178210(VS.80).aspx
0
 
Samuel LiewCommented:
question not specific enough.

Try this:
<input type="button" value="Click me" onclick=load(this)" />

Open in new window

0
 
ayha1999Author Commented:
hi,

I want to execute the following using Response.Write or Page.RegisterStartUpScript.

onclick=load(this)"

and also how can I write the function itself using response.write in the code-behind?

function load(menu) {
  if (window.dialogArguments && dialogArguments.location) {
    dialogArguments.location.href = "mypage.aspx?id=1";   //maybe you have to put the full address here
    window.close();
  }
}

ayha
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.