Article View: pl.comp.lang.javascript
Article #51067Re: skrypt dziala tylko w firefoksie a IE go olewa
From: agentwacek
Date: Thu, 22 Mar 2012 21:00
Date: Thu, 22 Mar 2012 21:00
58 lines
2433 bytes
2433 bytes
Jeszcze raz wklejam calosc bo wczesniej nie wkleilo mi wszystkiego a dokladnie
<br> teraz powinien byc kompletny kod ktory dziala pod firefox a pod IE nie
chu chu.
<form name="form1" method="post" action="jakistamplik.php" onsubmit="return
checkForm(this)"
<br>Wprowadz:
<input type="text" name="user" size="5" maxlength="2" class="val">
<br>
<input type="submit" name="Submit" value="W Y S L I J"> </form>
<script type="text/javascript" language="JavaScript">
var ClassName = "val"; //nazwa klasy elementow,
var FocusColor = "#FFCC00"; //kolor podswietlenia niewypelnionego pola
function checkForm(theForm) {
var error = false;
var inputfields = document.getElementsByTagName("input");
var textareas = document.getElementsByTagName("textarea");
for(var x = 0 ; x < inputfields.length ; x++ ) {
if(inputfields[x].getAttribute("class") == ClassName) {
if (inputfields[x].value.length == 0) {
inputfields[x].style.background = FocusColor;
error = true;
} else {
inputfields[x].style.background = 'White';
}
}
}
for(var x = 0 ; x < textareas.length ; x++ ) {
if(textareas[x].getAttribute("class") == ClassName) {
if (textareas[x].value.length == 0) {
textareas[x].style.background = FocusColor;
error = true;
} else {
textareas[x].style.background = 'White';
}
}
}
if(error == true) {
alert("WYPELNIJ PODSWIETLONE POLE!");
return false;
}
}
</script>
--
Wysลano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Technical Details
Message-ID:
<jkg3tf$ef1$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<jkg0v3$16i$1@inews.gazeta.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: " " <agentwacek@WYTNIJ.gazeta.pl> Newsgroups: pl.comp.lang.javascript Subject: Re: skrypt dziala tylko w firefoksie a IE go olewa Date: Thu, 22 Mar 2012 21:00:31 +0000 (UTC) Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 58 Message-ID: <jkg3tf$ef1$1@inews.gazeta.pl> References: <jkg0v3$16i$1@inews.gazeta.pl> NNTP-Posting-Host: localhost X-Trace: inews.gazeta.pl 1332450031 14817 172.20.26.242 (22 Mar 2012 21:00:31 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Thu, 22 Mar 2012 21:00:31 +0000 (UTC) X-User: agentwacek X-Forwarded-For: 46.134.204.182 X-Remote-IP: localhost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit