Created
April 13, 2015 09:55
-
-
Save gluschenko/6c24e2cf127f4e45b890 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<head> | |
<title>Генератор случайных чисел</title> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script> | |
function Write(id, val) { | |
Find(id).innerHTML = val; | |
} | |
function Find(id) { | |
var obj = document.getElementById(id); | |
return obj; | |
} | |
function Hide(id) { | |
if (document.getElementById(id)) { | |
document.getElementById(id).style.display = 'none'; | |
} | |
} | |
function Show(id) { | |
if (document.getElementById(id)) { | |
document.getElementById(id).style.display = 'block'; | |
} | |
} | |
function Hidden(id) | |
{ | |
if(Find(id).style.display == "none")return true; | |
return false; | |
} | |
function Exists(id) | |
{ | |
if(document.getElementById(id))return true; | |
return false; | |
} | |
function ReplaceDisplayStatus(first, second) | |
{ | |
var firstStatus = Find(first).style.display; | |
var secondStatus = Find(second).style.display; | |
Find(first).style.display = secondStatus; | |
Find(second).style.display = firstStatus; | |
} | |
function Reload() { | |
document.location.reload(true); | |
//Navigate(document.location.pathname); | |
} | |
function Navigate(url) { | |
document.location = url; | |
DebugLog("Navigate", url); | |
} | |
function DebugLog(name, msg) { | |
console.log(name + " -> " + msg); | |
} | |
function getRandomInt(min, max) | |
{ | |
return Math.floor((Math.floor(Math.random() * (max - min + 1)) + min)/10); | |
} | |
</script> | |
<style> | |
input | |
{ | |
border-radius: 10px; | |
padding: 5px; | |
outline: none; | |
} | |
</style> | |
</head> | |
<body style='background-color: #DDD;'> | |
<div style='height: 200px;'></div> | |
<div style='height: 200px; width: 400px; background-color: #444; border-radius: 30px; padding: 15px; margin: auto;'> | |
<div style='font-family: Arial; font-size: 22px; color: white;'>Генератор случайных чисел</div> | |
<div style='height: 5px;'></div> | |
<div style='height: 1px; background-color: white;'></div> | |
<div style='height: 5px;'></div> | |
<div id='out' style='font-family: Arial; font-size: 64px; color: yellow; text-align: center;'>0</div> | |
<div style='height: 5px;'></div> | |
<div style='height: 1px; background-color: white;'></div> | |
<div style='height: 15px;'></div> | |
<div style='text-align: center;'> | |
<input id='min' value='0'/> | |
<input id='max' value='100'/> | |
<br/> | |
<div style='height: 10px;'></div> | |
<input type='button' id='sub' value='Генерировать!' style='height: 40px; width: 200px;' onclick='Write("out", getRandomInt(Find("min").value, Find("max").value));'/> | |
</div> | |
</div> | |
<div style='height: 200px;'></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment