🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #51068

Re: skrypt dziala tylko w firefoksie a IE go olewa

#51068
From: Herr
Date: Fri, 23 Mar 2012 05:52
34 lines
1819 bytes
 Agent Wacek wrote:

> Zastanawiam sie dlaczego nie dziala pod IE a w firefoksie bezproblemowo dziala.
> Skrypt nie pozwala wyslac formularza gdy pole jest puste a IE tego skryptu nie
> łapie, gdzie babol ?

[rachu - ciachu]

Chyba tylko w IE7...
http://stackoverflow.com/questions/531508/getattribute-cannot-return-class-in-ie7

Zmień sposób pobierania klasy z elementu, np na taki:

if (inputfields[x].attributes['class']) { 
    var elemClass = inputfields[x].attributes['class'].nodeValue; 
} else { 
    var elemClass = inputfields[x].getAttribute('class'); 
}


a potem jeszcze warunek sprawdzający czy dany element posiada
odpowiednią klasę:

if(elemClass == ClassName) (...)



Co prawda kod przestanie działać jeżeli zaczniesz nadawać inputom kilka
klas, ale jak to rozwiązać - pozostawiam już Tobie ;)


-- 
Herr C(...)a
mój e-mail? http://cerbermail.com/?YWDqT8olYO
Technical Details
Message-ID: <jkh33m$n0f$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <jkg0v3$16i$1@inews.gazeta.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Herr <somepoorfella@someserver.out.there>
Newsgroups: pl.comp.lang.javascript
Subject: Re: skrypt dziala tylko w firefoksie a IE go olewa
Date: Fri, 23 Mar 2012 06:52:57 +0100
Organization: Megadeath, Inc.
Lines: 34
Message-ID: <jkh33m$n0f$1@node2.news.atman.pl>
References: <jkg0v3$16i$1@inews.gazeta.pl>
NNTP-Posting-Host: 89-75-143-232.dynamic.chello.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1332481975 23567 89.75.143.232 (23 Mar 2012 05:52:55 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Fri, 23 Mar 2012 05:52:55 +0000 (UTC)
User-Agent: Noworyta News Reader/2.9
X-Antivirus: avast! (VPS 120322-1, 2012-03-22), Outbound message
X-Antivirus-Status: Clean
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit