🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Przeładowanie formularzem i problem

#50242
From: Renke
Date: Sun, 05 Sep 2010 13:45
29 lines
2238 bytes
Programuje w PHP i teraz chciałem pobawić się javascriptem, napotkałem 
na problem przy przeładowaniu strony za pomocą formularza (zrobiłem 
zakłądki - tabs). Mój skrypt:

<script type="text/javascript">
    function klik(id) {
        var e = document.getElementById(id);
        if( e == foo1 )
          { e.style.display = 'block';
          document.getElementById('foo2').style.display = 'none';}
        if( e == foo2 )
          { e.style.display = 'block';
          document.getElementById('foo1').style.display = 'none';}
                        }
</script>
<a href="#" onclick="klik('foo1')">Click here1</a>
<a href="#" onclick="klik('foo2')">Click here 2</a>

<div id="foo1">This is foo1</div>
<div id="foo2"  style="display:none;">
This is foo2
<form><input type="submit" value="Submit" name="B1"></form></div>

Jeśli w foo2 przeładuje buttonem formularz to automatycznie włączy mi 
się zakładka 'foo1'. Czy jest jakaś metoda podtrzymania zmiennej 'foo2' 
po przeładowaniu ? W php zrobiłbym to najprościej przekazaniem GET w 
linku, może javascript daje inne możliwości ?

m.
Technical Details
Message-ID: <4c839f00$0$22800$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!nf1.ipartners.pl!ipartners.pl!plix.pl!newsfeed1.plix.pl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.kpn.net!pfeed09.wxs.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.134.4.91.MISMATCH!news2.euro.net!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!nf1.ipartners.pl!ipartners.pl!plix.pl!newsfeed1.plix.pl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.kpn.net!pfeed09.wxs.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.134.4.91.MISMATCH!news2.euro.net!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Sun, 05 Sep 2010 15:45:32 +0200
From: Renke <niemaemaila@o2.pl>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2
MIME-Version: 1.0
Newsgroups: pl.comp.lang.javascript
Subject: Przeładowanie formularzem i problem
Lines: 29
Message-ID: <4c839f00$0$22800$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 79.186.126.22
X-Trace: 1283694336 unt-rea-b-01.news.neostrada.pl 22800 79.186.126.22:1946
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit