Simple Question really. I have a JS function that accepts a passed parameter. On the chance that the passed value is NULL I want trap for it but my limited JS experience is causing me to not have the proper syntax. Here it is. What do I need to do to change the syntax? There is more to the function obviously but the rest of it works fine when I don't trap for the NULL. The bad syntax is on the last line and I know it has to do with using a reserved word but I am not sure how to make it work.
<script type="text/javascript">
    //Pass UserName from text box on form to Ajax call 
  function CheckUserName(UserName_element) {
      var UserName = try { UserName_element.value; } catch (e) { };
For those of you asking: It is a js function inside of a vbscript Sub (unfortunately the whole site is written in classic asp)
    Sub UserNameValidation_Entry()
%>
<div id="username_validation" style="width:15px;position:relative;float:right;">
<img id="valid_UserName_image" src="<%=UrlForAsset("/images/tick.png")%>" border="0" style="display:none;" alt="User Name is Available." 
    title="User Name is Avaliable." />
<img id="invalid_UserName_image" src="<%=UrlForAsset("/images/icon_delete_x_sm.png")%>" border="0" style="display:none;" alt="User Name Already Exists." 
    title="User Name Already Exists." />
</div>
<script type="text/javascript">
        //Pass UserName from text box on form to Ajax call 
      function CheckUserName(UserName_element) {
          var UserName = UserName_element.value; 
          var UserName = try { UserName_element.value; } catch (e) { };
        $j.ajax({
            data: { action: 'CheckUserName', p_UserName: UserName },
            type: 'GET',
            url: 'page_logic/_check_username_ajax.asp',
            success: function (result) {
                //If user exists return X out, if not return green checkmark
                if (result == "True") {
                    try { valid_UserName_image.style.display = "none"; } catch (e) { };
                    try { invalid_UserName_image.style.display = "inline"; } catch (e) { };
                }
                else {
                    try { valid_UserName_image.style.display = "inline"; } catch (e) { };
                    try { invalid_UserName_image.style.display = "none"; } catch (e) { };
                    }
                }
            }
        );
        //return false;
    }
</script>
Called from here.
           <tr class="required_field">
            <td class="empty"></td>
            <td><b>Username:</b></td>
            <td class="label_value_separator"></td>
            <td>
                <input type='text' name="username" size="24" maxlength="50" value="<%=Session("s_username") %>" onblur="CheckUserName(this);">
                <% Call UserNameValidation_Entry() %>
        </tr>
 
     
    