Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style type="text/css">
- div {border: 1px solid;}
- li {float : left; display : block; }
- </style>
- <ul>
- <li>Jeden</li>
- <li>Dwa</li>
- <li>Trzy</li>
- </ul>
- <p> nienio1</p>
- <p> nienio1</p>
- <p> nienio1</p>
- <p> nienio1</p>
- <div style="position: absolute; width: 300px; height: 300px; top: 100px; left: 100px;">
- <div style="visibility: none; position: absolute; width: 40px; height: 40px; top: 130px; left: 130px;"></div>
- <div style="visibility: none; position: relative; width: 100px; height: 100px; top: 10px; left: 10px; padding:30px; margin: 0px;">
- </div></div>
- <br><br><br><br><br>
- <p id = "string" style = "font-size : 5em">Zajebisty napis</p>
- <p>ext 2</p>
- <p>Text 3</p>
- <p>Text 4</p>
- <p>Text 5</p>
- <div>Tekscior</div>
- <script type = "text/javascript">
- function Licznik1() {
- this.licznik = 0;
- this.dajWartosc = function() {
- return this.licznik;
- }
- this.dodaj = function() {
- this.licznik += 1;
- }
- }
- function Licznik2() {
- this.dodaj = function() {
- var kopia = this.licznik;
- while (kopia > 0) {
- if (kopia % 10 == 1)
- this.licznik += 1;
- kopia = Math.floor(kopia / 10);
- }
- this.licznik += 1;
- }
- }
- Licznik2.prototype = new Licznik1;
- licznik1 = new Licznik1;
- licznik2 = new Licznik2;
- var ret = "";
- for (i = 0; i < 20; i++) {
- ret += licznik1.dajWartosc();
- ret += " ";
- ret += licznik2.dajWartosc();
- ret += "<br />";
- licznik1.dodaj();
- licznik2.dodaj();
- }
- document.write(ret);
- function forEach(tablica, action) {
- for (var i = 0; i < tablica.length; i++) {
- action(tablica[i]);
- }
- }
- var a = new Array("a", "b", "c");
- forEach(a, function(number) {
- document.write(number);
- });
- forEach([1, 2, 3, 4, 5, 6], function(number) {
- document.write(number);
- });
- document.write("<br/>" + Math.min.apply(this, [5, 6]));
- function Person(name, surname, age) {
- this.ID = 1;
- this.name = name;
- this.surname = surname;
- this.age = age;
- this.getName = function() {
- return this.name;
- }
- this.getSurname = function() {
- return this.surname;
- }
- this.getAge = function() {
- return this.age;
- }
- this.saySomething = function(whatToSay) {
- document.write(whatToSay);
- }
- };
- function Worker(position) {
- this.position = position;
- this.getPosition = function() {
- return this.position;
- }
- };
- Worker.prototype = new Person("Name", "Surname", null);
- Person.prototype.surname = "Unknow";
- document.write("<br/>Placek<br/>");
- var obiekt = new Person("John", "Smith", 90);
- var obiekt1 = new Worker("programmer");
- document.write(Array(obiekt1.getSurname(), obiekt1.getPosition()).join(" -!@!- ") + "<br/>");
- document.write(obiekt.getName());
- document.write("<br>" + obiekt.constructor);
- function malarz(tag, color) {
- return {
- maluj: function(i, j) {
- tags = document.getElementsByTagName(tag);
- for (var index = i; index <= j && index < tags.length; index++) {
- tags[index].style.color = color;
- //alert(tags[index].innerHTML);
- }
- },
- changeBackground: function(i, j) {
- tags = document.getElementsByTagName(tag);
- for (var index = i; index <= j && index < tags.length; index++) {
- tags[index].style.backgroundColor = color;
- tags[index].style.width = "10em";
- //tabs[index].style.fontWeight = "bold";
- //alert(tags[index].innerHTML);
- }
- }
- }
- }
- var Samochod = function(model) {
- var that = this;
- that.model = model;
- that.kolor = "bialy";
- that.jakiModel = function() {
- return "to " + that.model;
- }
- that.przemalujNa = function(kolor) {
- this.kolor = kolor;
- }
- }
- var garbus = new Samochod("Volkswagen");
- alert(garbus.jakiModel()); // "to Volksagen"
- garbus.przemalujNa("czerwony");
- alert(garbus.kolor); //"bialy"
- var a = malarz("p", "green");
- a.maluj(0, 3);
- var b = malarz("p", "blue");
- b.changeBackground(0, 0);
- var c = malarz("p", "purple");
- c.maluj(4, 4);
- /*
- // wikipedia
- site = { purpose : 'information' , storage : 'web' }
- Wikipedia = function() {
- this.complexity = 'vast'
- this.usefulness = 'notable'
- }
- Wikipedia.prototype = site
- Wikipedia.prototype.software = 'MediaWiki'
- alert((new Wikipedia).storage) // wyświetli: web
- alert((new Wikipedia).software) // wyświetli: MediaWiki
- function makeFunc() {
- var name = "Mozilla" ;
- function displayName () {
- alert(name) ;
- }
- return displayName ;
- }
- var myFunc = makeFunc();
- myFunc();
- var Counter = (function() {
- var privateCounter = 0;
- function changeBy(val) {
- privateCounter += val;
- }
- return {
- increment: function() { changeBy(1); },
- decrement: function() { changeBy(-1); },
- value: function() { return privateCounter; }
- }
- })();
- Counter.increment(); alert(Counter.value());
- function Employee () {
- this.name = "plum" ;
- alert("new Employee");
- }
- function WorkerBee ( ) {
- alert("new WorkerBee");
- }
- WorkerBee.prototype = new Employee;
- amy = new WorkerBee;
- alert(amy.name)
- Employee.prototype.name = "Unknown"
- alert(amy.name)
- */
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement