Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
js-practice/index.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
224 lines (191 sloc)
8.76 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="apple-touch-icon" href="apple-touch-icon.png"> | |
<!-- Place favicon.ico in the root directory --> | |
<link rel="stylesheet" href="css/normalize.css"> | |
<link rel="stylesheet" href="css/main.css"> | |
<script src="js/vendor/modernizr-2.8.3.min.js"></script> | |
<!-- MY JS --> | |
<script type="text/javascript"> | |
prompt() | |
var name = prompt(); alert(name); //Alert screen comes up saying name | |
var name = prompt('What is your first name?'); var lastName= prompt('What is your last name?'); alert(name+''+lastName); | |
</script> | |
<script type="text/javascript"> | |
var myvariable; //var= variable (declared) | |
confirm('This is an example of using JS to create some interaction on a website. Click OK to continue!'); | |
prompt("What is your name?") | |
if ("Brando".length >= 7 ) | |
{ | |
console.log("You have a long name!"); | |
} | |
else | |
{ | |
// What should we do if the condition is false? Fill in here: | |
console.log("You have a short name") | |
} | |
if (10 === 10) { | |
console.log("You got a true!"); | |
} | |
else | |
{ | |
console.log("You got a false!"); | |
} | |
if (12 / 4 === "Ari".length) { | |
confirm("Will this run the first block?"); | |
} | |
else | |
{ | |
confirm("Or the second block?"); | |
} | |
var d=new Date(); //Time and Date | |
document.write('Today is ' + d + ' <br> '); | |
var myvariable = 20; //intialize variable | |
myvariable = 20; // "=" assignment operator | |
var userAge = 25; //integer | |
var bookPrice = 39.95;//float "floating point" | |
var username = "Brandon"//string | |
document.write(username); | |
document.write(bookPrice); | |
document.write(userAge); | |
document.write(myvariable); | |
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0); | |
</script> | |
<script type="text/javascript"> | |
// Use console.log( ) to print out the substrings. | |
// Here is an example of the 1st to 4th letter of "JavaScript": | |
// console.log("JavaScript".substring(0,4)); | |
console.log("January".substring(0,3)); | |
console.log("Melbourne is great".substring(0,13)); | |
console.log("Hamburgers".substring(3,11)); | |
</script> | |
<script type="text/javascript"> | |
// | |
// Description: Randomly change background color every 5 seconds | |
// | |
function setbackground() | |
{ | |
window.setTimeout( "setbackground()", 5000); // 5000 milliseconds delay | |
var index = Math.round(Math.random() * 9); | |
var ColorValue = "FFFFFF"; // default color - white (index = 0) | |
if(index == 1) | |
ColorValue = "FFCCCC"; //peach | |
if(index == 2) | |
ColorValue = "CCAFFF"; //violet | |
if(index == 3) | |
ColorValue = "A6BEFF"; //lt blue | |
if(index == 4) | |
ColorValue = "99FFFF"; //cyan | |
if(index == 5) | |
ColorValue = "D5CCBB"; //tan | |
if(index == 6) | |
ColorValue = "99FF99"; //lt green | |
if(index == 7) | |
ColorValue = "FFFF99"; //lt yellow | |
if(index == 8) | |
ColorValue = "FFCC99"; //lt orange | |
if(index == 9) | |
ColorValue = "CCCCCC"; //lt grey | |
document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue; | |
} | |
</script> | |
<p id="scroller"></p> | |
<script type="text/javascript"> | |
// Letter Scroll | |
function scroll(position) { | |
var msg = "You dig my javascript skillz? I wonder how long I can keep on doing this javascript for? I mean what am I really learning from all this copy and pasting..."; | |
var out = ""; | |
var sc = document.getElementById("scroller"); | |
for (var i=0; i < position; i++){ | |
out += msg.charAt(i); | |
} | |
out += msg.charAt(position); | |
sc.innerHTML = out; | |
position++; | |
if (position != msg.length) { | |
window.setTimeout(function() { scroll(position); }, 150); | |
} | |
else { | |
window.setTimeout(function() { scroll(0); }, 10000); | |
} | |
} | |
scroll(0); | |
</script> | |
//<body onload="setbackground();"> | |
//<script type="text/javascript"> | |
// javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0); | |
</script> | |
// <script language="javascript"> | |
function chngimg(n){ | |
if(n){ | |
document.images['fst'].src="nobuttn.gif"; | |
document.images['sec'].src="blnkbut.gif"; | |
}else{ | |
document.images['sec'].src="nobuttn.gif"; | |
document.images['fst'].src="blnkbut.gif"; | |
}} | |
</script> | |
<script type="text/javascript"> | |
javascript: alert(34343+3434-222); | |
</script> | |
<script type="text/javascript"> | |
if (navigator.onLine && window.location.hostname === 'patorjk.com') { | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-3312460-1']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
} | |
//</script> | |
</head> | |
<body> | |
<!--[if lt IE 8]> | |
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> | |
<![endif]--> | |
<!-- Add your site or application content here --> | |
<ul class="nav navbar-nav navbar-right"> | |
<li><a href="#"><img src="img/wifi(24).png" alt="#" class="columnimg"></a></li> | |
<li><a href="#"><img src="img/facebook(24).png" alt="#" class="columnimg"></a></li> | |
<li><a href="#"><img src="img/twitter(24).png" alt="#" class="columnimg"></a></li> | |
<li><a href="#"><img src="img/linkedin(24).png" alt="#" class="columnimg"></a></li> | |
</ul> | |
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | |
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script> | |
<script src="js/plugins.js"></script> | |
<script src="js/main.js"></script> | |
<div id="game-area" tabindex="0"> | |
</div> | |
<div class="snake-try-again-dialog"> | |
</div> | |
<script type="text/javascript" src="./js/snake.js"></script> | |
<script type="text/javascript"> | |
var mySnakeBoard = new SNAKE.Board( { | |
boardContainer: "game-area", | |
fullScreen: true | |
}); | |
</script> | |
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. --> | |
<script> | |
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]= | |
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date; | |
e=o.createElement(i);r=o.getElementsByTagName(i)[0]; | |
e.src='https://www.google-analytics.com/analytics.js'; | |
r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); | |
ga('create','UA-XXXXX-X','auto');ga('send','pageview'); | |
</script> | |
<script type='text/javascript'><!--//<![CDATA[ | |
var ox_u = '//ads.ad4game.com/www/delivery/al.php?zoneid=51038&layerstyle=footer&position=bottom&speed=3&slide=0&delay=-&transparent=0'; | |
if (document.context) ox_u += '&context=' + escape(document.context); | |
document.write("<scr"+"ipt type='text/javascript' src='" + ox_u + "'></scr"+"ipt>"); | |
//]]>--></script> | |
</body> | |
</html> |