14 Şubat 2015 Cumartesi

Making a Photo Gallery in Javascript


HTML
<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <div>
            <button onclick="prev()"> Prev </button>
            <img id="slider" src="http://www.sololearn.com/uploads/slider/1.jpg" width="200px" height="100px"/>
            <button onclick="next()"> Next </button>
        </div>
    </body>
</html>

CSS

button {
    margin-top:30px;
    float:left;
    height:50px;
}
img {
    float:left;
    margin-right:10px;
    margin-left:10px;
}

JS
var promptName = prompt("Whats your Name?");
var promptAge = prompt("How old are you?");

function person(){
    this.name = promptName;
    this.age = promptAge;
    this.birth = gelenYear;
}

function gelenYear(){
    return 2016 - this.age;
}

var p1 = new person();

document.write("Your name is " + p1.name + " and your birth year is " + p1.birth());

Hiç yorum yok:

Yorum Gönder