Re: client-side scripting

Discussion in 'ASP .Net' started by Chris Jackson, Aug 18, 2003.

  1. > For some reason I cannot execute the client-side script in
    > <script language="javascript>
    > </script>
    > block in my .aspx page.
    > Does it require to enable a setting in the browser?


    You do have to have scripting enabled on the browser.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
     
    Chris Jackson, Aug 18, 2003
    #1
    1. Advertising

  2. Chris Jackson

    Serge Guest

    Hi Chris,

    Thanks for responding. I am running everything locally,
    and I checked if scripting was enabled, it seems that it
    was. I haved looked uder Tools\Internet Options, selected
    Security tab, selected Custom Level button. Under
    Scripting, Active scripting is set to Enable.
    Is there any other place that it can be set?

    Thanks,
    Serge.

    >-----Original Message-----
    >> For some reason I cannot execute the client-side script

    in
    >> <script language="javascript>
    >> </script>
    >> block in my .aspx page.
    >> Does it require to enable a setting in the browser?

    >
    >You do have to have scripting enabled on the browser.
    >
    >--
    >Chris Jackson
    >Software Engineer
    >Microsoft MVP - Windows XP
    >Windows XP Associate Expert
    >--
    >
    >
    >.
    >
     
    Serge, Aug 18, 2003
    #2
    1. Advertising

  3. Can you post the relevant snippet of code, and what browser (version) you
    are using?

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
    "Serge" <> wrote in message
    news:0a9601c365a2$802ebd80$...
    > Hi Chris,
    >
    > Thanks for responding. I am running everything locally,
    > and I checked if scripting was enabled, it seems that it
    > was. I haved looked uder Tools\Internet Options, selected
    > Security tab, selected Custom Level button. Under
    > Scripting, Active scripting is set to Enable.
    > Is there any other place that it can be set?
    >
    > Thanks,
    > Serge.
    >
    > >-----Original Message-----
    > >> For some reason I cannot execute the client-side script

    > in
    > >> <script language="javascript>
    > >> </script>
    > >> block in my .aspx page.
    > >> Does it require to enable a setting in the browser?

    > >
    > >You do have to have scripting enabled on the browser.
    > >
    > >--
    > >Chris Jackson
    > >Software Engineer
    > >Microsoft MVP - Windows XP
    > >Windows XP Associate Expert
    > >--
    > >
    > >
    > >.
    > >
     
    Chris Jackson, Aug 18, 2003
    #3
  4. Is btnSubscribe an input type=button, or an asp:button? If you are using an
    asp:button, then the web control is writing its own javascript for the
    postback, and yours is being discarded. If it's an input type=button, try
    removing the runat=server, if you have it.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
    "Serge" <> wrote in message
    news:0b1101c365aa$e1fd1090$...
    > In the .aspx page I added this block right under the
    > <head> tag:
    > <script language="javascript">
    > function btnSubscribe_Click()
    > {
    > alert(
    > "Hello Serge!");
    > }
    > </script>
    >
    > In the .aspx.cs file I added this code in Page_Load:
    > btnSubscribe.Attributes.Add("onClick",
    > "return btnSubscribe_Click();");
    >
    >
    > >-----Original Message-----
    > >Can you post the relevant snippet of code, and what

    > browser (version) you
    > >are using?
    > >
    > >--
    > >Chris Jackson
    > >Software Engineer
    > >Microsoft MVP - Windows XP
    > >Windows XP Associate Expert
    > >--
    > >"Serge" <> wrote in message
    > >news:0a9601c365a2$802ebd80$...
    > >> Hi Chris,
    > >>
    > >> Thanks for responding. I am running everything locally,
    > >> and I checked if scripting was enabled, it seems that it
    > >> was. I haved looked uder Tools\Internet Options,

    > selected
    > >> Security tab, selected Custom Level button. Under
    > >> Scripting, Active scripting is set to Enable.
    > >> Is there any other place that it can be set?
    > >>
    > >> Thanks,
    > >> Serge.
    > >>
    > >> >-----Original Message-----
    > >> >> For some reason I cannot execute the client-side

    > script
    > >> in
    > >> >> <script language="javascript>
    > >> >> </script>
    > >> >> block in my .aspx page.
    > >> >> Does it require to enable a setting in the browser?
    > >> >
    > >> >You do have to have scripting enabled on the browser.
    > >> >
    > >> >--
    > >> >Chris Jackson
    > >> >Software Engineer
    > >> >Microsoft MVP - Windows XP
    > >> >Windows XP Associate Expert
    > >> >--
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
     
    Chris Jackson, Aug 18, 2003
    #4
  5. Your code to implement client side scripting is correct. Just view source
    and check it out - you only get to have one handler, so if you are
    generating two, that is the problem.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
    "Serge" <> wrote in message
    news:0a1601c365c1$94fe4090$...
    > Based on the book I am reading, it should work in both
    > cases. In the first case, it is an HTML server control, in
    > the second case it is a Web server control. I have looked
    > up a couple of books and they all have the same type of
    > samples. The latest book, ASP.NET Essentials, also have a
    > similar sample. By the way, this sample will only work for
    > a Web server controls because I am accessing the Attribute
    > property of button control. This seems to be the standard
    > code on how to implement custom client-side scripting.
    >
    > >-----Original Message-----
    > >Is btnSubscribe an input type=button, or an asp:button?

    > If you are using an
    > >asp:button, then the web control is writing its own

    > javascript for the
    > >postback, and yours is being discarded. If it's an input

    > type=button, try
    > >removing the runat=server, if you have it.
    > >
    > >--
    > >Chris Jackson
    > >Software Engineer
    > >Microsoft MVP - Windows XP
    > >Windows XP Associate Expert
    > >--
    > >"Serge" <> wrote in message
    > >news:0b1101c365aa$e1fd1090$...
    > >> In the .aspx page I added this block right under the
    > >> <head> tag:
    > >> <script language="javascript">
    > >> function btnSubscribe_Click()
    > >> {
    > >> alert(
    > >> "Hello Serge!");
    > >> }
    > >> </script>
    > >>
    > >> In the .aspx.cs file I added this code in Page_Load:
    > >> btnSubscribe.Attributes.Add("onClick",
    > >> "return btnSubscribe_Click();");
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Can you post the relevant snippet of code, and what
    > >> browser (version) you
    > >> >are using?
    > >> >
    > >> >--
    > >> >Chris Jackson
    > >> >Software Engineer
    > >> >Microsoft MVP - Windows XP
    > >> >Windows XP Associate Expert
    > >> >--
    > >> >"Serge" <> wrote in message
    > >> >news:0a9601c365a2$802ebd80$...
    > >> >> Hi Chris,
    > >> >>
    > >> >> Thanks for responding. I am running everything

    > locally,
    > >> >> and I checked if scripting was enabled, it seems

    > that it
    > >> >> was. I haved looked uder Tools\Internet Options,
    > >> selected
    > >> >> Security tab, selected Custom Level button. Under
    > >> >> Scripting, Active scripting is set to Enable.
    > >> >> Is there any other place that it can be set?
    > >> >>
    > >> >> Thanks,
    > >> >> Serge.
    > >> >>
    > >> >> >-----Original Message-----
    > >> >> >> For some reason I cannot execute the client-side
    > >> script
    > >> >> in
    > >> >> >> <script language="javascript>
    > >> >> >> </script>
    > >> >> >> block in my .aspx page.
    > >> >> >> Does it require to enable a setting in the

    > browser?
    > >> >> >
    > >> >> >You do have to have scripting enabled on the

    > browser.
    > >> >> >
    > >> >> >--
    > >> >> >Chris Jackson
    > >> >> >Software Engineer
    > >> >> >Microsoft MVP - Windows XP
    > >> >> >Windows XP Associate Expert
    > >> >> >--
    > >> >> >
    > >> >> >
    > >> >> >.
    > >> >> >
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
     
    Chris Jackson, Aug 19, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sumit
    Replies:
    1
    Views:
    328
    Rajesh.V
    Oct 16, 2003
  2. Boss302
    Replies:
    0
    Views:
    1,107
    Boss302
    Nov 21, 2006
  3. Bogdan
    Replies:
    2
    Views:
    687
    Bogdan
    Jun 9, 2008
  4. Zoe Hart
    Replies:
    1
    Views:
    403
    Scott Wisniewski
    Jan 8, 2004
  5. Kathryn
    Replies:
    9
    Views:
    225
    William Morris
    Oct 17, 2003
Loading...

Share This Page