Link to home
Start Free TrialLog in
Avatar of ayha1999
ayha1999

asked on

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
Avatar of Samuel Liew
Samuel Liew
Flag of Australia image

question not specific enough.

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

Open in new window

Avatar of ayha1999
ayha1999

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Kelevra
Kelevra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial