Site Search:
Sign in | Join | Help

This Blog

Syndication

Tags

Archives

Javascript

Stuff that everyone needs to know about Javascript
  • Used Javascript to check a radio box

    In a recent project I needed to check a radio button based on whether or not a text field was populated.

    <script language="javascript" type="text/javascript">
        if (document.frmCreateAccount.EMail.value=="")
          {
            document.frmCreateAccount.OKToEMailYes.checked=true;
          }
        else if (document.frmCreateAccount.EMail.value!="")
          {
          }
    </script> 

  • Debugging Javascript in Visual Studio 2005

    This post is taken verbatum from http://waltritscher.com/blog/ramblings/archive/2004/09/19/211.aspx. It's a great resource and a great technique; and I'm afraid I'll lose it - so I copied it here. Kudos to Walt.

    ASP.Net makes it very easy to write and debug server side code.  I've found when talking to ASP.Net developers that many of them don't know that you can debug client side script with VS.NET  too.

    This week I was working on a client web site and needed to write some client-side JavaScript.  This reminded me to post a quick how-to on client side debugging.

    Steps

    1. Enable client-side script debugging in Internet Explorer

    • Open Microsoft Internet Explorer.
    • On the Tools menu, click Internet Options.
    • On the Advanced tab, locate the Browsing section, and uncheck the Disable script debugging check box, and then click OK.

    2. Close Internet Explorer.

    3. In your JavaScript function add the keyword debugger. This causes VS.NET to switch to debug mode when it runs that line.

    4. Run your ASP.Net applicationin debug mode.

  • Include Javascript in a project

    I went to a greate Microsoft MSDN event last week, and as usual, Russ (www.russtoolshed.com) was excellent. One of the tips that he gave had to do with stepping through Javascript in Visual Studio 2005. I haven't been able to get it to work, but one of the things that had to be done was to include the JS in a separate file, not in the main .aspx page. This piece of code will do the include for you:

    <script type="text/javascript" src="~JobProgress.js"></script>

     

    As always, your comments are welcome.