Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] funkcja z innego pliku *.js
ewelinac18
post
Post #1





Grupa: Zarejestrowani
Postów: 99
Pomógł: 0
Dołączył: 11.07.2007

Ostrzeżenie: (0%)
-----


Nie mogę uruchomić funkcji, to moja pierwsza funkcja w JS

Plik reg.js
Kod
function RegistrationForm()
{
        var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
        var zip = window.document.registerForm.postcode.value;
        var numericExpression = /^[0-9-]+$/;
        var literyExp = /^[a-zA-Z]+$/;
        var error = "";


        if (window.document.registerForm.firstName.value == ''){
                error += "<li>Niewypełnione Dane osobowe - Imie  !</li>";
        }
        if (window.document.registerForm.lastName.value == ''){
                error += "<li>Niewypełnione Dane osobowe - Nazwisko !</li>";
        }
        if (window.document.registerForm.email.value.match(emailExp) == null){
                error += "<li>Niepoprawny email !</li>";
        }
        if (window.document.registerForm.phone.value.match(numericExpression) == null){
                error += "<li>Niepoprawny numer telefonu !</li>";
        }
        if (window.document.registerForm.add_1.value == ''){
                error += "<li>Niewypełnione Adres !</li>";
        }
        if (window.document.registerForm.town.value == ''){
                error += "<li>Niewypełnione Miasto !</li>";
        }
        if(window.document.registerForm.postcode.value.match(numericExpression) == null){
                error += "<li>Niepoprawny Kod pocztowy ! 99-999</li>";
        }
        if (window.document.registerForm.password.value != window.document.registerForm.passwordConf.value){
                error += "<li>Hasła dosiebie nie pasuj± !</li>";
        }
        document.getElementById("blad").innerHTML = error;


        if (error != ""){
                document.getElementById("erro").style.display = "block";
        } else {
                document.getElementById("erro").style.display = "none";
                { TU }
        }
}

tam gdzie { TU } chciałabym wstawić funkcje submitDoc('registerForm'); ale nie działa to :/

funkcja ta znajduje sie na innym pliku podczas wczytywania strony są ładowane obydwa pliki
num2.js
Kod
function submitDoc(formName) {
    var obj=findObj(formName);
    if (obj!=null) {
        obj.submit();
    } else {
        alert('The form you are attempting to submit called \'' + formName + '\' couldn\'t be found. Please make sure the submitDoc function has the correct id and name.');
    }
}

.........


czy może ktoś wie jak to rozwiązać (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Mize
post
Post #2





Grupa: Zarejestrowani
Postów: 84
Pomógł: 6
Dołączył: 26.03.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Pokaż jak ładujesz oba pliki i co wywala konsola błędów JS.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 04:14