Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript problem

Morten
Guest
 
Posts: n/a
#1: Nov 17 '05
Hi!

I'm trying to have a button open a Window using javascript. I want to open a
window pointing to a specific URL and close it imediately afterwards. I've
registered a javascript block in my code-behind file and used this code:

Button1.Attributes.Add("onclick", "javascript:popup()");
to have the button execute the script. Now my problem is that I need to
specify a parameter for the javascript function. More precisely I want the
content of a textbox to be sent to the javascript:

Button1.Attributes.Add("onclick", "javascript:popup(TextBox1.Text)");
but I can't figure out how to do this.

Hope someone can help.

Morten



carion1
Guest
 
Posts: n/a
#2: Nov 17 '05

re: javascript problem


myButton.Attributes.Add("onClick", "alert(document.theForm." + myText.ID +
".value);");

Instead of an alert you can call your function.

--

Derek Davis
ddavis76@gmail.com

"Morten" <morten_skovgaard@hotmail.com> wrote in message
news:OX2H$t3yFHA.2960@tk2msftngp13.phx.gbl...[color=blue]
> Hi!
>
> I'm trying to have a button open a Window using javascript. I want to open
> a window pointing to a specific URL and close it imediately afterwards.
> I've registered a javascript block in my code-behind file and used this
> code:
>
> Button1.Attributes.Add("onclick", "javascript:popup()");
> to have the button execute the script. Now my problem is that I need to
> specify a parameter for the javascript function. More precisely I want the
> content of a textbox to be sent to the javascript:
>
> Button1.Attributes.Add("onclick", "javascript:popup(TextBox1.Text)");
> but I can't figure out how to do this.
>
> Hope someone can help.
>
> Morten
>
>[/color]


The Crow
Guest
 
Posts: n/a
#3: Nov 17 '05

re: javascript problem


myText.ClientID is more correct. (if myText is contained in a naming
container control other then Page itself, its id will be added after its
parent seperated with _)


Closed Thread