🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
5 messages
5 total messages Started by BooB Wed, 02 Mar 2011 11:50
komunikat jest pusty lub nie jest obiektem
#50609
Author: BooB
Date: Wed, 02 Mar 2011 11:50
39 lines
2137 bytes
Witam , nie jestem biegły w JS ale potrzebowałem go użyć dla
kalulatora opłat notarialnych .
W Mozilli działa zaś w IE podaje komunikat taki jak poniżej .
Dodam , że w formularzu input ...name='cena_nieruchomosci' podałem
value domyślnie 0 .

Szczegóły błędu na stronie sieci Web
Wiadomość: 'document.forms.kalkulator.elements' jest pusty lub nie
jest obiektem
Wiersz: 15
Znak: 1
Kod: 0
Identyfikator URI: http://192.168.1.101/~nieruchomosc/kalkulator.js

poniżej pierwsze 20 linijek kodu.

function check()
{
var a = "0123456789";
var taksa_notarialna = 0;
var oplata_skarbowa = 0;
var VAT_od_taksy = 0;
var prowizja = 0;
var prowizja_agencji = 0;
var oplata_sadowa = 0;
var oplaty_dod = 0;
var procent_maksymalny=0;
var agencja_vat = 0;

form = document.forms['kalkulator'];
 tu jest 15 wiersz ---->wartosc =
document.forms['kalkulator'].elements['cena_nieruchomosci'].value;
i = wartosc.length - 1;
err = true;
j = 0;
for (var j = 0; j < a.length; j++)
{

proszę o podpowiedzi .
Re: komunikat jest pusty lub nie jest obiektem
#50610
Author: Szyk
Date: Wed, 02 Mar 2011 12:49
1 lines
1210 bytes
A masz formularz nazwany 'kalkulator'?
Re: komunikat jest pusty lub nie jest obiektem
#50611
Author: BooB
Date: Wed, 02 Mar 2011 14:15
5 lines
1346 bytes
On 2 Mar, 13:49, Szyk <szyk...@o2.pl> wrote:
> A masz formularz nazwany 'kalkulator'?

mam
 <form name="kalkulator">
Re: komunikat jest pusty lub nie jest obiektem
#50612
Author: Szyk
Date: Wed, 02 Mar 2011 15:58
36 lines
2333 bytes
Ło matko!!!!

Czytałeś w ogóle coś na temat dorywania się do elementów formularza z 
JS??? Bo ten błąd znaczy tyle, że elements są "nie halo". Ja nie robię w 
tym temacie, ale w sekundę sobie wygooglałem coś takiego: 
http://www.quirksmode.org/js/forms.html i tam jest pod koniec fajny 
rozdział "Accessing the form elements". No i tam podaje się 2 metody:

1)
document.forms[number].elements[number]

W tym wypadku musisz z bani podać numery wynikające z pozycji formularza 
(pierwszy number) i elementu w formularzu (drugi number). No i 
oczywiście musisz tych numerów pilnować!!!


2)
In some cases, it's better to use the names of the forms and elements. 
In HTML, you have to give a name to each form and each element, like:

<form name="personal" action="something.pl" onsubmit="return checkscript()">
<input type=text size=20 name=name>
<input type=text size=20 name=address>
<input type=text size=20 name=city>
</form>

Now you can access these elements by:

document.personal.name
document.personal.address
document.personal.city

W tym wypadku nazwy mają automagicznie zmieniać się w obiekty.


Nie sprawdziłem ani pierwszej ani drugiej metody, więc nie ręczę za to...
Re: komunikat jest pusty lub nie jest obiektem
#50613
Author: BooB
Date: Thu, 03 Mar 2011 09:41
36 lines
2549 bytes
On 2 Mar, 16:58, Szyk <szyk...@o2.pl> wrote:
> o matko!!!!
>
> Czyta e w og le co na temat dorywania si do element w formularza z
> JS??? Bo ten b d znaczy tyle, e elements s "nie halo". Ja nie robi w
> tym temacie, ale w sekund sobie wygoogla em co takiego:http://www.quirksmode.org/js/forms.htmli tam jest pod koniec fajny
> rozdzia "Accessing the form elements". No i tam podaje si 2 metody:
>
> 1)
> document.forms[number].elements[number]
>
> W tym wypadku musisz z bani poda numery wynikaj ce z pozycji formularza
> (pierwszy number) i elementu w formularzu (drugi number). No i
> oczywi cie musisz tych numer w pilnowa !!!
>
> 2)
> In some cases, it's better to use the names of the forms and elements.
> In HTML, you have to give a name to each form and each element, like:
>
> <form name="personal" action="something.pl" onsubmit="return checkscript()">
> <input type=text size=20 name=name>
> <input type=text size=20 name=address>
> <input type=text size=20 name=city>
> </form>
>
> Now you can access these elements by:
>
> document.personal.name
> document.personal.address
> document.personal.city
>
> W tym wypadku nazwy maj automagicznie zmienia si w obiekty.
>
> Nie sprawdzi em ani pierwszej ani drugiej metody, wi c nie r cz za to...

bardzo dziekuję za wskazówki .
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads