Re: I don't get javascript. How do you use it?
- From: "Tony Girgenti" <tony(nospam)@lakesideos.com>
- Date: Sat, 24 Mar 2007 13:52:31 -0400
Hello Mark and Mark.
I tried it both Mark Fitzpatrick's way and Mark Rae's way. Either way does
not give an error, but it does not do anything.
<input id="Button1" style="z-index: 103; left: 496px; position: absolute;
top: 392px"
type="button" value="button" onClick="ShowCal;" />
<asp:Button ID="Button2" runat="server" Style="z-index: 104; left: 688px;
position: absolute; top: 392px" Text="Button" onClientClick="ShowCal();" />
When i click Button1, it does nothing and puts an "Error on page" on the
bottom of the IE screen and does nothing. When i click Button2, i can see
the progress bar at the bottom of the IE screen, but it does nothing.
Thanks,
Tony
"Mark Rae" <mark@xxxxxxxxxxxxxxxxx> wrote in message
news:uKWUbTjbHHA.4888@xxxxxxxxxxxxxxxxxxxxxxx
"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: Jasbird
- Re: I don't get javascript. How do you use it?
- From: Göran Andersson
- 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
- Re: I don't get javascript. How do you use it?
- From: Mark Rae
- I don't get javascript. How do you use it?
- Prev by Date: Re: Free ASP .net Ebooks
- Next by Date: Re: I don't get javascript. How do you use it?
- 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):