Re: I don't get javascript. How do you use it?
- From: "Mark Rae" <mark@xxxxxxxxxxxxxxxxx>
- Date: Sat, 24 Mar 2007 16:52:51 -0000
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:OfTZE7ibHHA.2300@xxxxxxxxxxxxxxxxxxxxxxx
I tried some javascript testing in VS2005, SP1, VB , .NET 2.0, ASP.NET 2.0
on WIN XP Pro, SP2.
It's real simple. I put a button on a page and coded the onClick in it
like this:
<asp:Button ID="Button1" runat="server" Style="z-index: 103; left: 528px;
position: absolute; top: 392px" Text="Button" OnClick="ShowCal" />
Here is the function:
<script type="text/javascript" language="javascript">
function ShowCal() {
var x = Button1.Style.z - index;
alert(x);
}
</script>
It won't let me run the program saying "'ShowCal' is not a member of
'ASP.default_aspx'"
If javascript is so popular, why can't i use it?
Because you're not calling it... The OnClick event of an <asp:Button> will
cause the page to post back (unless you're using AJAX or something similar)
and try to run a server-side method...
Change your code to the following:
<asp:Button ID="Button1" runat="server" Style="z-index: 103; left: 528px;
position: absolute; top: 392px" Text="Button" OnClientClick="ShowCal();" />
.
- Follow-Ups:
- Re: I don't get javascript. How do you use it?
- From: Tony Girgenti
- Re: I don't get javascript. How do you use it?
- References:
- I don't get javascript. How do you use it?
- From: Tony Girgenti
- I don't get javascript. How do you use it?
- Prev by Date: Re: Connection String to connect to an Oracle DB in a remote server
- Next by Date: Re: Dynamic Listbox in Gridview
- Previous by thread: Re: I don't get javascript. How do you use it?
- Next by thread: Re: I don't get javascript. How do you use it?
- Index(es):
Loading