🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: wczytać plik po wczytaniu strony

#51307
From: chochlik_drukarski
Date: Mon, 17 Jun 2013 06:18
33 lines
2147 bytes
Użytkownik "zlotowinfo" <dupa@dupa.xx> napisał w wiadomości 
news:kpfkib$1d2$1@node2.news.atman.pl...
> chodzi o załadowanie danych z pliku po wczytaniu strony
> dane te są ciągle zmieniane, nazwa niezmienna
>
> po kliknięciu przycisku:
> Wiersz: 1
> Błąd: Nie można uzyskać właściwości "pole1": obiekt jest pusty lub 
> niezdefiniowany
>
> {...trochę śmietnik...}

U mnie te document.write wywołane w onClick czyści caly dokument.

Spróbój tak:

<head>
<script src="1.js"></script>
<script id="test"></script>
</head>
<body>
<form name="myform">
    pole1: <input name="pole1"><br>
    pole2: <input name="pole2">
    <input type="button" 
onClick="document.getElementById('test').src='2.js'; return false;">
</form>
</body>

W sekcji head pusty skrypt z nadanym id. W onClick coś co temu skryptowi 
ustawia własność src. Gdyby był problem z keszowaniem tego pliku przez 
przeglądarke to można zrobić np '2.js?'+Math.random() 
Technical Details
Message-ID: <kpm9f8$p8c$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
References: <kpfkib$1d2$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From: "chochlik_drukarski" <chochlik_drukarski@wp.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: wczytać plik po wczytaniu strony
Date: Mon, 17 Jun 2013 08:18:52 +0200
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <kpm9f8$p8c$1@dont-email.me>
References: <kpfkib$1d2$1@node2.news.atman.pl>
Mime-Version: 1.0
Injection-Date: Mon, 17 Jun 2013 06:14:00 +0000 (UTC)
Injection-Info: mx05.eternal-september.org; posting-host="79da0216cafa04b507ff2c39029b3bea"; logging-data="25868"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fGFjMyMXYRWQrfdEQmQqC"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-EsetScannerBuild: 14088
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
Cancel-Lock: sha1:7U7ixlk7PN3Gs9vB3DVYPNx2wfc=
X-Priority: 3
X-MSMail-Priority: Normal
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit