Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 24th, 2008, 05:16 PM
Authorized User
 
Join Date: Sep 2006
Location: Belgrade, Serbia, Yugoslavia.
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT
Default Firefox vs. IE - Javascript problem

Hi guys,

Once again, I'm having problems with javascript in IE.
I can't make the following code working in IE like it works in Firefox.

Code:
var args = document.getElementsByTagName('input');
    for (var i=0; i<args.length; i++)
    {
        if (args[i].getAttribute('type') == 'text')
        {
            args[i].setAttribute('class', 'blurControl');

            args[i].onfocus = function()
            {
                this.setAttribute('class', 'focusControl');
            }

            args[i].onblur = function()
            {
                this.setAttribute('class', 'blurControl');
            }
        }
    }
Any suggestions please?

Thanks

Aleksandar Dragosavac
Belgrade, Serbia
__________________
Aleksandar Dragosavac
Belgrade, Serbia
  #2 (permalink)  
Old September 24th, 2008, 05:53 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

In MSIE the attribute is called "className" not just "class".

Use both and then your code works.

Example:
            args[i].onblur = function()
            {
                this.setAttribute('class', 'blurControl');
                this.setAttribute('className', 'blurControl');
            }
  #3 (permalink)  
Old September 25th, 2008, 03:28 AM
Authorized User
 
Join Date: Sep 2006
Location: Belgrade, Serbia, Yugoslavia.
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT
Default

Ya, that's it. Thanks a lot!

Cheers

Aleksandar Dragosavac
Belgrade, Serbia


Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript textarea problem with FireFox dparsons Javascript How-To 0 May 19th, 2008 08:34 PM
javascript with PHP in MAC's Firefox jasmine2 Xcode 0 July 12th, 2007 05:17 AM
Javascript - Firefox is not supporting lakshmi252002 General .NET 0 April 17th, 2007 12:14 AM
Firefox javascript error akkad Ajax 2 November 27th, 2006 10:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.