2016-11-01

Nov 2 Let's Build Something.

Post your solutions to this thread for the Nov 2 Let's build Something.
Best, Chris
Post your solutions to this thread for the Nov 2 Let's build Something. Best, Chris

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html>
    <head>
        <title>A joke</title>
        <meta charset="utf-8" />
    </head>
    <body>
        <form action="get">
            <div>Title</div>
            <input type="text" name="title">
<div>Author</div> <input type="text" name="author">
<div>Publisher</div> <input type="text" name="publisher">
<div>Year</div> <input type="text" name="year">
<button onclick="save somth">Save</button> </form> <?php ?> </body>
</html>
<!DOCTYPE html> <html> <head> <title>A joke</title> <meta charset="utf-8" /> </head> <body> <form action="get"> <div>Title</div> <input type="text" name="title"><br> <div>Author</div> <input type="text" name="author"><br> <div>Publisher</div> <input type="text" name="publisher"><br> <div>Year</div> <input type="text" name="year"><br> <button onclick="save somth">Save</button> </form> <?php ?> </body> </html>

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html> <head>
	<title>JavaScript
	</title>
</head> <body>
	<form>
		<label>Title<input id = "title" type = "text"></label>
		<label>Author<input id = "author" type = "text"></label>
		<label>Publisher<input id = "publisher" type = "text"></label>
		<label>Year<input id ="year" type = "text"></label>
		<button onclick = "book={
			title: document.getElementById('title').value,
			author: document.getElementById('author').value,
			publisher: document.getElementById('publisher').value,
			year: document.getElementById('year').value
		};
		">Save</button>
	</form>
	<a href="#" onclick = "
	bookAsString='';
	if(typeof book !== undefined){
		for(prop in book){
			bookAsString+=book[prop]+'\n';
		}
	}
	alert(bookAsString);
	">Show Book</a>
</body> </html>
(Edited: 2016-11-02)
<!DOCTYPE html> <html> <head> <title>JavaScript </title> </head> <body> <form> <label>Title<input id = "title" type = "text"></label> <label>Author<input id = "author" type = "text"></label> <label>Publisher<input id = "publisher" type = "text"></label> <label>Year<input id ="year" type = "text"></label> <button onclick = "book={ title: document.getElementById('title').value, author: document.getElementById('author').value, publisher: document.getElementById('publisher').value, year: document.getElementById('year').value }; ">Save</button> </form> <a href="#" onclick = " bookAsString=''; if(typeof book !== undefined){ for(prop in book){ bookAsString+=book[prop]+'\n'; } } alert(bookAsString); ">Show Book</a> </body> </html>

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html>
    <head>
        <title></title>
        <meta charset="utf-8" />
    </head>
    <body>
        <form>
            <label for="title">Title</label>
            <input id="title" type="text">
            
            <label for="author">Author</label>
            <input id="author" type="text">
            
            <label for="publisher">Publisher</label>
            <input id="publisher" type="text">
            
            <label for="year">Year</label>
            <input id="year" type="text">
            
            <input id="submit" 
                   type="submit" 
                   value="Save" 
                   onclick=
                   "book = {
                        title: document.getElementById('title').value,
                        author: document.getElementById('author').value,
                        publisher: document.getElementById('publisher').value,
                        year: document.getElementById('year').value
                    };
                    alert(
                        'Title: '+book.title+'\n'+
                        'Author: '+book.author+'\n'+
                        'Publisher: '+book.publisher+'\n'+
                        'Year: '+book.year);">
        </form>
    </body>
</html>
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> </head> <body> <form> <label for="title">Title</label> <input id="title" type="text"> <label for="author">Author</label> <input id="author" type="text"> <label for="publisher">Publisher</label> <input id="publisher" type="text"> <label for="year">Year</label> <input id="year" type="text"> <input id="submit" type="submit" value="Save" onclick= "book = { title: document.getElementById('title').value, author: document.getElementById('author').value, publisher: document.getElementById('publisher').value, year: document.getElementById('year').value }; alert( 'Title: '+book.title+'\n'+ 'Author: '+book.author+'\n'+ 'Publisher: '+book.publisher+'\n'+ 'Year: '+book.year);"> </form> </body> </html>

-- Nov 2 Let's Build Something
Title Author publisher year
(Edited: 2016-11-02)
<nowiki><!DOCTYPE html> <html> <head> </head> <body> <form> <label for="title">Title</label> <input type="text" id="title"> <label for="author">Author</label> <input type="text" id="author"> <label for="publisher">publisher</label> <input type="text" id="publisher"> <label for="year">year</label> <input type="text" id="year"> <input type="submit" onclick=" book = new Object(); book.title = document.getElementById('title').value; book.author = document.getElementById('author').value; book.publisher = document.getElementById('publisher').value; book.year = document.getElementById('year').value; alert('title: ' + book.title + '\n' + 'author: ' + book.author + '\n' + 'publisher: ' + book.publisher + '\n' + 'year: ' + book.year);" </form> </body> </html></nowiki>

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html>
	<head>
			<title>potato</title>
	</head>
	<body>
		<div>
			<label for="title">Title</label>
			<input type="text" name="title" id="title">
			<label for="title">Author</label>
			<input type="text" name="author" id="author">
			<label for="title">Publisher</label>
			<input type="text" name="publisher" id="publisher">
			<label for="title">Year</label>
			<input type="text" name="year" id="year">
			<button onclick="savebook()">Save</button>
		</div>
		<script type="text/javascript">
			var savebook = function() {
				var book = {
					title: document.getElementById('title').value,
					author: document.getElementById('author').value,
					publisher: document.getElementById('publisher').value,
					year: document.getElementById('year').value
				};
				alert("Title: " + book.title + "\nAuthor: " + book.author + "\nPublisher: " + book.publisher + "\nYear: " + book.year);
			};
		</script>
	</body>
</html>
(Edited: 2016-11-02)
<!DOCTYPE html> <html> <head> <title>potato</title> </head> <body> <div> <label for="title">Title</label> <input type="text" name="title" id="title"> <label for="title">Author</label> <input type="text" name="author" id="author"> <label for="title">Publisher</label> <input type="text" name="publisher" id="publisher"> <label for="title">Year</label> <input type="text" name="year" id="year"> <button onclick="savebook()">Save</button> </div> <script type="text/javascript"> var savebook = function() { var book = { title: document.getElementById('title').value, author: document.getElementById('author').value, publisher: document.getElementById('publisher').value, year: document.getElementById('year').value }; alert("Title: " + book.title + "\nAuthor: " + book.author + "\nPublisher: " + book.publisher + "\nYear: " + book.year); }; </script> </body> </html>

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html>
	<head>
	<meta charset="utf-8">
	</head>
	<body>
		<label for="title">Title</label> 
<input type="text" id="title">
<label for="author">Author</label>
<input type="text" id="author">
<label for="publisher">Publisher</label>
<input type="text" id="publisher">
<label for="year">Year</label>
<input type="text" id="year">
		<input type="submit" value="Save" onclick=
		"book = {
			title: document.getElementById('title').value,
			author: document.getElementById('author').value,
			publisher: document.getElementById('publisher').value,
			year: document.getElementById('year').value
		};
		alert('Title: '+ book.title +
				'\n'+'Author: '+ book.author +
				'\n'+'Publisher: '+ book.publisher +
				'\n'+'Year: '+ book.year);">
	</body>
</html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <label for="title">Title</label> <br> <input type="text" id="title"> <br> <label for="author">Author</label> <br> <input type="text" id="author"> <br> <label for="publisher">Publisher</label> <br> <input type="text" id="publisher"> <br> <label for="year">Year</label> <br> <input type="text" id="year"> <br> <input type="submit" value="Save" onclick= "book = { title: document.getElementById('title').value, author: document.getElementById('author').value, publisher: document.getElementById('publisher').value, year: document.getElementById('year').value }; alert('Title: '+ book.title + '\n'+'Author: '+ book.author + '\n'+'Publisher: '+ book.publisher + '\n'+'Year: '+ book.year);"> </body> </html>

-- Nov 2 Let's Build Something
Im using a function in JavaScript !
<!DOCTYPE html> <html> <head>
	<title>Build Something</title>
</head> <body>
	<label>Title</label>
	<input id="title">
	<label>Author</label>
	<input id="author">
	<label>Publisher</label>
	<input id="publisher">
	<label>Year</label>
	<input id="year">
	<button onclick="book()">Save</button>
<p id="result"></p>
<script type="text/javascript">
	function book(){
		var data = {
			Title: document.getElementById("title").value,
			Author: document.getElementById("author").value,
			Publisher: document.getElementById("publisher").value,
			Year: document.getElementById("year").value
			};
		var msg = document.getElementById("result");
		if(typeof data === 'undefined') {
			alert("variable data is undefined");
		}
		else {
			return msg.innerHTML = "Title: " + data.Title +"
"+ "Author: "+ data.Author +"
"+ "Publisher:" + data.Publisher +"
"+ "Year: " + data.Year; } }
</script>
</body> </html>
Im using a function in JavaScript ! <!DOCTYPE html> <html> <head> <title>Build Something</title> </head> <body> <label>Title</label> <input id="title"> <label>Author</label> <input id="author"> <label>Publisher</label> <input id="publisher"> <label>Year</label> <input id="year"> <button onclick="book()">Save</button> <p id="result"></p> <script type="text/javascript"> function book(){ var data = { Title: document.getElementById("title").value, Author: document.getElementById("author").value, Publisher: document.getElementById("publisher").value, Year: document.getElementById("year").value }; var msg = document.getElementById("result"); if(typeof data === 'undefined') { alert("variable data is undefined"); } else { return msg.innerHTML = "Title: " + data.Title +"<br/>"+ "Author: "+ data.Author +"<br/>"+ "Publisher:" + data.Publisher +"<br/>"+ "Year: " + data.Year; } } </script> </body> </html>

-- Nov 2 Let's Build Something
<!DOCTYPE html>
 <html>
 <head>
 <title>Lets buils something</title>
 </head>
 <body>
 <form>
 <input type="text" id="title" />
 <input type="text" id="Author" />
 <input type="text" id="publisher" />
 <input type="text" id="year" />
 <input type="submit" value="save" onclick="book = new Object();book.titleval=document.getElementById('title').value;
 book.authorval=document.getElementById('Author').value;
 book.publisherval=document.getElementById('publisher').value;
 book.yearval=document.getElementById('year').value;
 alert(book.titleval+'\n'+book.authorval+'\n'+book.publisherval+'\n'+book.yearval);"/>
 </form>
 </html>
<!DOCTYPE html> <html> <head> <title>Lets buils something</title> </head> <body> <form> <input type="text" id="title" /> <input type="text" id="Author" /> <input type="text" id="publisher" /> <input type="text" id="year" /> <input type="submit" value="save" onclick="book = new Object();book.titleval=document.getElementById('title').value; book.authorval=document.getElementById('Author').value; book.publisherval=document.getElementById('publisher').value; book.yearval=document.getElementById('year').value; alert(book.titleval+'\n'+book.authorval+'\n'+book.publisherval+'\n'+book.yearval);"/> </form> </html>

-- Nov 2 Let's Build Something
<!DOCTYPE html> <html> <head>
	<title> Book Details </title>
</head> <body>
	<form>
  		Title:
<input type="text" id="formtitle"/>
Author:
<input type="text" id="authname"/>
Publisher:
<input type="text" id="pubname"/>
Year:
<input type="text" id="year"/>
<input type="button" value="Save" onclick="return storeInfo();"/> </form> <script type="text/javascript"> function storeInfo() { book = new Object(); book.title = document.getElementById("formtitle").value; book.authname = document.getElementById("authname").value; book.pubname = document.getElementById("pubname").value; book.year = document.getElementById("year").value; alert(book.title+book.authname+book.pubname+book.year); } </script>
</body> </html>
<!DOCTYPE html> <html> <head> <title> Book Details </title> </head> <body> <form> Title:<br> <input type="text" id="formtitle"/><br> Author:<br> <input type="text" id="authname"/><br> Publisher:<br> <input type="text" id="pubname"/><br> Year:<br> <input type="text" id="year"/><br> <input type="button" value="Save" onclick="return storeInfo();"/> </form> <script type="text/javascript"> function storeInfo() { book = new Object(); book.title = document.getElementById("formtitle").value; book.authname = document.getElementById("authname").value; book.pubname = document.getElementById("pubname").value; book.year = document.getElementById("year").value; alert(book.title+book.authname+book.pubname+book.year); } </script> </body> </html>
X