Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 04:18 PM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript in asp.net

hi

<script language="javascript">
          function shownext()
          {
          //alert("hello");
          location.href="http://www.google.com";
          alert("hello");
          }
          </script>
     </HEAD>
     <body MS_POSITIONING="GridLayout">
          <form id="Form1" method="post" runat="server">
               <a href="javascript:;" onclick="shownext()">hello </a>
          </form>
     </body>

I have a call to a function in a href click..and the strange thing is ...

as you can see i am trying to redirect and it only redirects if i have the alert statement after that...otherwise nothing happens...

why is that so....


 
Old October 25th, 2004, 04:32 PM
Authorized User
 
Join Date: Oct 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

your code, with a little change, is working for me:

<%@ Page Language="VB" %>
<script runat="server">

    ' Insert page code here
    '

</script>
<html>
<head>
    <script language="javascript">
          function shownext()
          {

            window.location.href="http://www.google.com";

          }
    </script>
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <a href="javascript:shownext();">hello </a>
    </form>
</body>
</html>


----------------------
wagner reatto
 
Old October 29th, 2004, 09:35 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you.

do u know why my code was working with alert statement but not with out alert

 
Old October 30th, 2004, 08:28 AM
Authorized User
 
Join Date: Oct 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

pran here it is your 'source code' in browser:

<html>
<head>
    <script language="javascript">
          function shownext()
          {
          //alert("hello");
          location.href="http://www.google.com";
          //alert("hello");
          }
          </script>
</head>
<body ms_positioning="GridLayout">
    <form name="Form1" method="post" action="NewFil1e.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtNjU0MzcyMTk1Ozs+b7/6a1SRgoz2hT8CGcYPe3y7zu8=" />

        <a href="javascript:;" onclick="shownext()">hello </a>
    </form>

</body>
</html>

i can say: it is working!



----------------------
wagner reatto





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net 2.0 and JavaScript zion22 Javascript How-To 0 September 28th, 2006 01:28 PM
asp.Net 2.0 and JavaScript zion22 ASP.NET 2.0 Professional 0 September 28th, 2006 01:10 PM
javascript in asp.net Komila Generics 0 August 3rd, 2006 01:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.