Article View: pl.comp.lang.javascript
Article #39466Re: jak to zrobic obiektowo
From: B.Orzech
Date: Sun, 16 Apr 2006 23:04
Date: Sun, 16 Apr 2006 23:04
26 lines
1910 bytes
1910 bytes
Powiedzmy, ze mozna to zrobic tak:
function moj_obiekt(tresc){
this.tresc=document.createTextNode(tresc)
this.obj=document.createElement("p")
this.obj.appendChild(this.tresc)
this.obj.onclick=function(){
this.removeChild(this.firstChild)
this.tresc=document.createTextNode("ala bez kota")
this.appendChild(this.tresc)
}
document.body.appendChild(this.obj)
return this
}
z malym "ale"
swoje obiekty inicializuj po zaladowaniu strony tzn.
window.onload=function(){
var moj_nowy_obiek=new moj_obiekt("zajaczek");
}
albo w <body onload="moja_funkcja_na_start()">
jakos takos by to chyba bylo. Polecam zabawe z
document.createElement()
Pewnie mozna to zrobic na 10 innych sposobow, ktore chlopaki opisza
ci w nastepnych postach:)
Pozdrawiam.
Technical Details
Message-ID:
<1145228679.832898.77240@v46g2000cwv.googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!v46g2000cwv.googlegroups.com!not-for-mailReferences:
<e1rnpq$kh7$1@atlantis.news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!v46g2000cwv.googlegroups.com!not-for-mail From: "B.Orzech" <mentor_bo@poczta.onet.pl> Newsgroups: pl.comp.lang.javascript Subject: Re: jak to zrobic obiektowo Date: 16 Apr 2006 16:04:39 -0700 Organization: http://groups.google.com Lines: 27 Message-ID: <1145228679.832898.77240@v46g2000cwv.googlegroups.com> References: <e1rnpq$kh7$1@atlantis.news.tpi.pl> NNTP-Posting-Host: 83.27.203.98 Mime-Version: 1.0 X-Trace: posting.google.com 1145228689 11393 127.0.0.1 (16 Apr 2006 23:04:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 16 Apr 2006 23:04:49 +0000 (UTC) In-Reply-To: <e1rnpq$kh7$1@atlantis.news.tpi.pl> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: v46g2000cwv.googlegroups.com; posting-host=83.27.203.98; posting-account=9KoXfA0AAACWn_uTZ4rMNaTkJ4KeSMh5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit