Skip to content

Instantly share code, notes, and snippets.

@apucacao
Forked from anonymous/index.html
Last active February 8, 2018 15:18
Show Gist options
  • Save apucacao/8171371094cb7f1ad92372b7d29f1016 to your computer and use it in GitHub Desktop.
Save apucacao/8171371094cb7f1ad92372b7d29f1016 to your computer and use it in GitHub Desktop.
Exported from Popcode.

Example Code

Math functions

function operation(input A, inputB){
    return ;
}

Click handlers

$("button").click(function(){
  var inputA = $("#inputA").val();
  var inputB = $("#inputB").val();
  operation(inputA, inputB);       
});
<!DOCTYPE html>
<html>
<head>
<title>ScriptEd Robot 1</title>
<link href="https://fonts.googleapis.com/css?family=Space+Mono|Audiowide" rel="stylesheet">
</head>
<body>
<h1> ScriptEd Robot</h1>
<img src="https://images-mm.s3.amazonaws.com/Futurama_Bender_Face_Gray_Shirt_POP.jpg">
<div>
<input id="inputA" placeholder="A">
<input id="inputB" placeholder="B">
</div>
<br>
<div>
<button id="add">A + B</button>
<!-- Write all of your other buttons here -->
</div>
<br>
<div>
Answer = <span id="result"></span>
</div>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["console","editor.css"]}
/////////////////////////////////////
// Define your robot functions
/////////////////////////////////////
// Add (+)
function add(inputA, inputB) {
return parseInt(inputA) + parseInt(inputB);
}
// Subtract (-)
// Multiply (*)
// Divide (/)
// (A + B) / 2
// Say hello
/////////////////////////////////////
// Define your click handlers
/////////////////////////////////////
// Add (+)
$('#add').click(function() {
// What do you want to do when the "+" button is clicked?
var inputA = $("#inputA").val();
var inputB = $("#inputB").val();
var result = add(inputA, inputB);
$("#result").text(result);
});
// Subtract (-)
// Multiply (*)
// Divide (/)
// (A + B) / 2
// Say hello
img {
height:180px;
}
h1{
font-family: 'Audiowide', cursive;
font-size:48px;
margin:0px;
}
body{
text-align:center;
}
input {
font-size:12px;
text-align: center;
}
div {
margin-top:3px;
font-family: 'Space Mono', monospace;
font-size: 24px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment