Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2016 10:10
Show Gist options
  • Save anonymous/06cba51d8ad0235eae41089e94b9843b to your computer and use it in GitHub Desktop.
Save anonymous/06cba51d8ad0235eae41089e94b9843b to your computer and use it in GitHub Desktop.
Classwork 5 // source https://jsbin.com/qulaqo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Classwork 5</title>
</head>
<body>
<span id="abTest">Enter Text </span>
<input id="getName" value="name please" onkeyup="updateName()"></input><br>
<span id="name">name</span>
<span id="time">time</span>
<script id="jsbin-javascript">
function updateName(){
document.getElementById('name').textContent = document.getElementById('getName').value;
}
function updateTime(){
document.getElementById('time').textContent = `, the current time is ${new Date().toLocaleTimeString()}`;
}
setInterval(updateTime,10);
//abtest section
var array = new Uint32Array(1);
window.crypto.getRandomValues(array);
//console.log(array[0]%2);
if(array[0]%2){
document.getElementById('abTest').innerHTML = `Your name please`;
document.getElementById('getName').setAttribute('value','here');
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">function updateName(){
document.getElementById('name').textContent = document.getElementById('getName').value;
}
function updateTime(){
document.getElementById('time').textContent = `, the current time is ${new Date().toLocaleTimeString()}`;
}
setInterval(updateTime,10);
//abtest section
var array = new Uint32Array(1);
window.crypto.getRandomValues(array);
//console.log(array[0]%2);
if(array[0]%2){
document.getElementById('abTest').innerHTML = `Your name please`;
document.getElementById('getName').setAttribute('value','here');
}</script></body>
</html>
function updateName(){
document.getElementById('name').textContent = document.getElementById('getName').value;
}
function updateTime(){
document.getElementById('time').textContent = `, the current time is ${new Date().toLocaleTimeString()}`;
}
setInterval(updateTime,10);
//abtest section
var array = new Uint32Array(1);
window.crypto.getRandomValues(array);
//console.log(array[0]%2);
if(array[0]%2){
document.getElementById('abTest').innerHTML = `Your name please`;
document.getElementById('getName').setAttribute('value','here');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment