Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Other Programming - Perl, C++, Java, ASP, .NET Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-09-2006, 01:50 PM   #1 (permalink)
kw91
Junior Member
 
Join Date: Aug 2006
Posts: 4
Default Javascript Check Browser not working

Hi,
I need the users to have at least Internet Explorer 5.5 to be able to log into my site. So, I have written a javascript to check a users browser before they can login and if the check fails, it unhides text within a DIV that tells the user to update their browser, and should disable the login forms.

I have tested this script by upping the browser version required to 6.5 (i only have 6.0), and when my browser fails, it unhides the text between the DIV tags, but does not lock the login forms. Any clues as to why?




Code:
<SCRIPT LANGUAGE="JavaScript1.2"> // Create the function CheckBrowser to disable //login forms if the function CheckBrowser2 // gives us problems function CheckBrowser() { if(!CheckBrowser2()){ document.login_form.username.disabled=true; document.login_form.password.disabled=true; document.login_form.login.disabled=true; document.login_form.reset.disabled=true; } else{ // Start with the cursor in the user_name field document.Form.username.focus(); } } function CheckBrowser2() { // Make sure Internet Explorer is at least version 5.0 // Checks if the user is running Microsoft Windows if(window.navigator.platform != "Win32"){ document.getElementById("error_browser").style.display = "block"; return false; //Checks if the user is running Microsoft Internet Explorer } if(window.navigator.appName != "Microsoft Internet Explorer"){ document.getElementById("error_browser").style.display = "block"; return false; } // Checks if the user is running Microsoft Internet Explorer 5.0 + appVer = window.navigator.appVersion; pos = appVer.indexOf("MSIE "); if(pos != -1){ pos2 = appVer.indexOf(";", pos + 1); appVersion = appVer.substring(pos + 5, pos2) - 0; if(appVersion <= 5.5){ document.getElementById("error_browser").style.display = "block"; return false; } } return true; } </SCRIPT>

Thanks.
kw91 is offline   Reply With Quote
Sponsored Links
Old 08-09-2006, 03:49 PM   #2 (permalink)
kw91
Junior Member
 
Join Date: Aug 2006
Posts: 4
Default Re: Javascript Check Browser not working

Nevermind. I figured it out.

This part was messed up

Code:
function CheckBrowser() { if(!CheckBrowser2()){ document.login_form.username.disabled=true; document.login_form.password.disabled=true; document.login_form.login.disabled=true; document.login_form.reset.disabled=true; }

I don't need the document.login_form.username.disabled=true;

I just need login_form.username.disabled=true;

...
kw91 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 05:47 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums