JavaScript Code To Toggle Check Boxes

Here is some JavaScript code to toggle check boxes (same action as radio buttons).

In the page load event register the JavaScript: 

   chkTwoYear.Attributes.Add(“onclick”, “javascript: CheckTwoProgram(” + chkTwoYear.ClientID + “);”); 
   chkFourYear.Attributes.Add(“onclick”, “javascript: CheckFourProgram(” + chkFourYear.ClientID + “);”);

In the HTML of the page add the JavaScript:

<SCRIPT Language=”JavaScript”><!–
function CheckTwoProgram(id) { 
   if(id.checked) 
      document.forms[0].chkFourYear.checked=false; 
   }
function CheckFourProgram(id) { 
   if(id.checked) 
      document.forms[0].chkTwoYear.checked=false; 
   }
//–>
</SCRIPT>

SPF Record

SPF is Sender Policy Framework. This is a tool to help fight spam by validating the from address of emails. When an email is received by an email server the sending domain can be checked for proper origination. Here is a sample rule in DNS:

v=spf1 ip4:67.169.211.46 mx ptr -all

Here is a tool to validate the rule as well as test it with the mail server:

http://www.kitterman.com/spf/validate.html

Enjoy.

CSS Page Break with IE 7

To force a page break when printing the style=”page-break-before: always;” can be added. But this doesn’t always work with IE 7. For some reason IE 7 would ignore this. Probably because of the new print preview and “size to fit”. The simple fix to get IE 7 to recognize the page break just add something to the div section. This worked for me.

<div style=”page-break-before: always;”>
   <!–[if IE 7]><br style=”height:0; line-height:0″><![endif]–>
</div>

 

VB.Net Format Phone Number Function

Here is a function to format phone numbers. I picked it up from here: http://www.freevbcode.com/ShowCode.asp?ID=1968

‘Takes any entered phone number and returns it in ###-#### format
‘or (###) ###-####

Public Function FormatPhoneNumber(ByVal sNumToBeFormatted As _
   String) As String

Dim iNumberLength As Integer ‘Used for the Phone Number length
  
‘Trim any leading and trailing spaces

sNumToBeFormatted = Trim$(sNumToBeFormatted)
  
‘Length of the phone number.

iNumberLength = Len(sNumToBeFormatted)
  
Select Case iNumberLength

  Case 7  ‘Format : #######

    FormatPhoneNumber = Left$(sNumToBeFormatted, 3) & _
        “-” & Right$(sNumToBeFormatted, 4)
    Exit Function

  Case 8  ‘Format : ###-#### or ### ####

    If Mid$(sNumToBeFormatted, 4, 1) = “-” Then
       FormatPhoneNumber = sNumToBeFormatted
       Exit Function
    Else
       FormatPhoneNumber = Left$(sNumToBeFormatted, 3) & “-” & _
          Right$(sNumToBeFormatted, 4)
       Exit Function
    End If

  Case 10 ‘Format : ##########

 FormatPhoneNumber = “(” & Left$(sNumToBeFormatted, 3) & “) ” _
   & Mid$(sNumToBeFormatted, 4, 3) & “-” & _
     Right$(sNumToBeFormatted, 4)
 
   Exit Function

  Case 11 ‘Format ######-####

 FormatPhoneNumber = “(” & Left$(sNumToBeFormatted, 3) & “) ” & _
       Right$(sNumToBeFormatted, 8)
    Exit Function

  Case 12 ‘Format : ### ###-####

 FormatPhoneNumber = “(” & Left$(sNumToBeFormatted, 3) & “) ” & _
      Mid$(sNumToBeFormatted, 5, 3) & “-” & _
      Right$(sNumToBeFormatted, 4)
    Exit Function

  Case 13 ‘Format : (###)###-####
     FormatPhoneNumber = Left(sNumToBeFormatted, 5) & ” ” & _
        Right(sNumToBeFormatted, 8)
     Exit Function


  Case Else
        ‘Return Value Passed
     FormatPhoneNumber = sNumToBeFormatted
          
End Select

End Function

Ways to Still Use IE6

Some users of IE7 have difficulty logging in to various portal websites with IE7. Here are a couple of options to continue to use IE6.

1. Here is a link that installs an IE6 emulator. It functions for exactly one session and then reverts to IE7.

http://go.microsoft.com/fwlink/?LinkID=70356

It was found it on nVidia’a partner website. They say:

“Currently, NVIDIA is working to ensure all its applications are compatible with the new version. In the meantime to login to the portal you will require Internet Explorer 6 (IE 6). NOTE: This does not mean you need to revert to IE 6, Microsoft has provided a utility that will allow you to access NVIDIA’s portal while continuing to use IE 7. This utility emulates IE 6 for your current browser session only. To quickly return to the portal after the utility is installed, we recommend you save the portal link as a Favorite in your browser. “

Using the Utility
Once the utility has been installed, go to Start > All Programs and select the “User Agent String Utility”. The dialog box below will appear. Select “Just change my settings” and then press the “Change Settings” button.

Thanks to Wynn Smith.

2. Upgrade local IE6 to IE7 but still run IE6 in Virtual PC 2004 for free:

Virtual PC 2004 SP1

http://www.microsoft.com/downloads/details.aspx?FamilyId=6D58729D-DFA8-40BF-AFAF-20BCB7F01CD1&displaylang=en

Internet Explorer 6 Application Compatibility VPC Image http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en

Thanks to Charles Bernard.

DISCLAIMER: I have not tried either of these methods.

IE7 Tabbed Browsing

Another comment about IE7 – I use SHIFT when clicking a hyper link to open a new window a lot. At times I get up to 20 open windows. To open a new TABBED window I now hold down the CTRL key when clicking a hyper link. The CTRL-TAB keys work like ALT-TAB to cycle through the tabbed windows just like many other Windows programs. So far IE7 has worked well for me. How is it working for you?

FTP Not supported in IE7

I’ve been using IE7 for a couple of days now. I just ran into a feature I used in IE6 that isn’t in IE7. In IE6 I’ve created hyperlinks that will open up an FTP site and automatically log me in. The current version of IE7 does not support FTP. That’s one way to be more secure – remove the feature altogether! What I get now is a page that says “To view this FTP site in Windows Explorer, click Page, and then click Open FTP Site in Windows Explorer.” At least the “Page” button has a “Open FTP Site in Windows Explorer” option. It is a bit annoying though.