0% found this document useful (0 votes)
19 views

Topalian JavaScript Math Generator by Christopher Topalian

A fun educational JavaScript application that teaches how to make a Math Generator. Happy Scripting :-) Video: https://www.youtube.com/watch?v=8LKJIZ4x7RA Code: https://github.com/ChristopherTopalian/Topalian_JavaScript_Math_Generator
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Topalian JavaScript Math Generator by Christopher Topalian

A fun educational JavaScript application that teaches how to make a Math Generator. Happy Scripting :-) Video: https://www.youtube.com/watch?v=8LKJIZ4x7RA Code: https://github.com/ChristopherTopalian/Topalian_JavaScript_Math_Generator
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Topalian

JavaScript
Math
Generator
by
Christopher Andrew Topalian
All Rights Reserved
Copyright 2000-2024
Dedicated
to
God the Father
<!-- Dedicated to God the Father -->

<!-- All Rights Reserved Christopher Topalian


Copyright 2000-2024 -->

<!-- https://github.com/ChristopherTopalian --
>

<!--
https://github.com/ChristopherAndrewTopalia
n -->

<!--
Topalian_JavaScript_Math_Generator.html -->

<!-- Version 001 - (2024-01-16) -->

<html>
<head>
<title> Topalian JavaScript Math Generator
</title>

<link rel = 'stylesheet' href =


'css/style001.css'>

<script>

function ge(whichId)
{
let result =
document.getElementById(whichId);

return result;
}

function ce(whichType)
{
let result =
document.createElement(whichType);

return result;
}

function ba(whichElement)
{
let result =
document.body.append(whichElement);

return result;
}

function createMathGenerator()
{
// mainDiv
let mainDiv = ce('div');
mainDiv.id = 'mainDiv';
mainDiv.className = 'mainDiv';
mainDiv.style.position = 'relative';
mainDiv.style.width = 300 + 'px';
ba(mainDiv);

//-//

// theTitle
let theTitle = ce('div');
theTitle.innerHTML = 'Math Exercise
Generator';
theTitle.className = 'theTitle';
mainDiv.append(theTitle);

//-//
// generate button
let generateButton = ce('button');
generateButton.textContent = 'Generate';
generateButton.id = 'generateButton';
generateButton.className =
'buttonStyle001';
generateButton.onclick = function()
{
ge('textBox1').value =
Math.floor(Math.random() * 100);

ge('textBox2').value =
Math.floor(Math.random() * 100);

ge('textBox3').value = '';
ge('textBox4').value = '';
ge('mainDiv').style.borderColor =
'rgb(255, 255, 255)';
};
mainDiv.append(generateButton);

//-//

// textBox1
let textBox1 = ce('input');
textBox1.type = 'text';
textBox1.value = Math.floor(Math.random()
* 100);
textBox1.id = 'textBox1';
mainDiv.append(textBox1);

//-//

// textBox2
let textBox2 = ce('input');
textBox2.type = 'text';
textBox2.value = Math.floor(Math.random()
* 100);
textBox2.id = 'textBox2';
mainDiv.append(textBox2);

//-//

// textBox3
let textBox3 = ce('input');
textBox3.type = 'text';
textBox3.id = 'textBox3';
textBox3.onchange = function()
{
let text1 =
parseFloat(ge('textBox1').value);
let text2 =
parseFloat(ge('textBox2').value);

let text3 =
parseFloat(ge('textBox3').value);

let evaluated = eval(text1 + text2);

console.log(evaluated);

if (text3 == evaluated)
{
console.log('Correct');

ge('textBox4').value = 'Correct :-)';

ge('mainDiv').style.borderColor =
'rgb(0, 255, 255)';
}
else
{
console.log('Not that');

ge('textBox4').value = 'Not that';

ge('mainDiv').style.borderColor =
'rgb(255, 0, 0)';
}
}
mainDiv.append(textBox3);

//-//

// textBox4
let textBox4 = ce('input');
textBox4.type = 'text';
textBox4.id = 'textBox4';
mainDiv.append(textBox4);
}

</script>

</head>

<body onload = 'createMathGenerator();'>

</body>

</html>
/* Dedicated to God the Father */

/* All Rights Reserved Christopher Topalian


Copyright 2000-2024 */

/* https://github.com/ChristopherTopalian */

/*
https://github.com/ChristopherAndrewTopalia
n */

/* style001.css */

body
{
background-color: rgb(40, 40, 40);
font-family: arial;
font-size: 30px;
color: rgb(255, 255, 255);
}

input
{
padding-left: 10px;
padding-right: 10px;
padding-top: 2px;
padding-bottom: 2px;
background-color: rgb(30, 30, 30);
font-size: 30px;
color: rgb(255, 255, 255);
}

hr
{
width: 100%;
}
.mainDiv
{
border-style: solid;
border-width: 2px;
display: flex;
flex-direction: column;
margin: auto;
}

.theTitle
{
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
margin: auto;
font-family: arial;
font-size: 20px;
}

.buttonStyle001
{
padding-top: 3px;
padding-bottom: 3px;
padding-left: 10px;
padding-right: 10px;
border-radius: 8px;
background-color: rgb(0, 0, 0);
font-family: arial;
font-size: 20px;
color: rgb(255, 255, 255);
}

.buttonStyle001:hover
{
border-color: rgb(0, 255, 255);
}

.buttonStyle001:active
{
color: rgb(0, 255, 255);
}
True Artificial Intelligence System
16-Gon
Tautology
MI 1111 CI
1101 1011
AND XNOR
0001 1001
LP RP
0011 0101

OR NOR
0111 1000

RC LC
1010 1100

XOR NAND
0110 1110
CNI MNI
Contra-
0100 0010
-diction
0000
For More Tutorials:
CollegeOfScripting.weebly.com

CollegeOfScripting.wordpress.com

Youtube.com/ScriptingCollege

Twitter.com/CollegeOfScript

GitHub.com/ChristopherTopalian

GitHub.com/ChristopherAndrewTopalian

Sites.google.com/view/CollegeOfScripting
Dedicated to God the Father
This book is created by the
College of Scripting Music & Science.
Always remember, that each time you write a script
with a pencil and paper, it becomes imprinted so
deeply in memory that the material and methods are
learned extremely well.
When you Type the scripts, the same is true. The
more you type and write out the scripts by keyboard
or pencil and paper, the more you will learn
programming!
Write and Type every example that you find.
Keep all of your scripts organized.
Every script that you create increases your
programming abilities.
SEEING CODE, is one thing,
but WRITING CODE is another.
Write it, Type it, Speak It, See It, Dream It.
CollegeOfScripting.weebly.com

You might also like