Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me bring down my pause, stop and play button so that it is unde

ID: 3922641 • Letter: C

Question

Can someone help me bring down my pause, stop and play button so that it is under my type here box. I aslo need help bring down my type here box so people can fully see the letters that are popping up on the screen. I also need a 45 sec timer at the top right because mines didnt work.

<html>
<head>
<style>
.buttonPosition{
    margin: -20px -50px;
    position:relative;
    top:310px;
    left:200px;
}
.button {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
   border-radius: 8px;
}
.box:active{
    width: 100%;
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
}
.button2:active {
   background-color: #e7e7e7;
   box-shadow: 0 5px #008CBA;
   transform: translateY(2px);
}
.button3:active {
   background-color: #008CBA;
   box-shadow: 0 5px #f44336;
   transform: translateY(2px);
}
.button4:active {
   background-color: #008CBA;
   box-shadow: 0 5px #e7e7e7;
   transform: translateY(2px);
}
.button2 {
   //position:fixed;
   //top: 400px;
//   left: 300px;
   background-color: #008CBA;
} /* Blue */
.button3 {
   //position:fixed;
   //top: 400px;
   //left: 400px;
   background-color: #f44336;
} /* Red */
.button4 {
   //position:fixed;
   //top: 400px;
   //left: 500px;
   background-color: #e7e7e7; color: black;
} /* Gray */
</style>
<script> //script starting tag
var displayedText = "";
var score = 0;
var INCREMENT = 10;
var DECREMENT = 5;
var playFlag = false;
var LEVEL = [];
LEVEL.push({NUM:1 , SEQ:'a'}); //assigning level 1-11 into array
LEVEL.push({NUM:1 , SEQ:'A'});  
LEVEL.push({NUM:2 , SEQ:'a'});  
LEVEL.push({NUM:2 , SEQ:'A'});  
LEVEL.push({NUM:3 , SEQ:'aAa'});  
LEVEL.push({NUM:3 , SEQ:'a#'});  
LEVEL.push({NUM:4 , SEQ:'A#'});  
LEVEL.push({NUM:4 , SEQ:'A#a'});
LEVEL.push({NUM:5 , SEQ:'AAa'});
LEVEL.push({NUM:5 , SEQ:'#Aa'});
LEVEL.push({NUM:6 , SEQ:'aA#a'});
var CURRENTLEVEL=LEVEL[0];//you can change the level here by changing index
                          //value upto 9

function play(){ //javascript function to play the game
   playFlag=true;
   display();   //calling the display function
}
function randomString(length, chars) {//assigning displaying elements
    var mask = '';
    if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz';
    if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    if (chars.indexOf('#') > -1) mask += '0123456789';
   // if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*()_+-={}[]:";'<>?,./|\';
    var result = '';
    for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)];
    return result;
}
function display(){ //function to display the charecters on the desktop
   displayedText = randomString(CURRENTLEVEL.NUM, CURRENTLEVEL.SEQ);
   document.getElementById('displayCharSequence').innerHTML = displayedText;
   DisplayScore();
}
function incrementScore(){ //function for incrementing the score
   score = score+INCREMENT;
}
function decrementScore(){ //function for decrementing the Score
   if(score > 0)
   score = score - DECREMENT;
   else
   score = 0;
}
function DisplayScore(){ //funtion for displaying the score
   document.getElementById('score').innerHTML = score;
}
function clearTyped(){
   document.getElementById('typed').value = "";
}
function check(obj){ //function for checking the object for play,pause,stop
   var val = new String();
   val = obj.value;
   if(val == displayedText && playFlag){
       incrementScore();
       DisplayScore();
       clearTyped();
       display();
   }
function startTimer(duration, display) { //function for time calculations
    var start = Date.now(),diff,minutes,seconds;
    function timer() {
        diff = duration - (((Date.now() - start) / 1000) | 0);
        minutes = (diff / 60) | 0;
        seconds = (diff % 60) | 0;
        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;
        display.textContent = minutes + ":" + seconds;
        if (diff <= 0) {
            start = Date.now() + 1000;
        }
    };
    timer();
    setInterval(timer, 1000);
}
window.onload = function () { //function for displaying the time and load the time
    var reqMinutes = 60 * 2,
        display = document.querySelector('#timeRemain');
    startTimer(reqMinutes, display);
};
}
</script>
</head>
<body>
   <div
      >
       <label >Score:<a id="score" href="#">0000</a></label>
   </div>
   <div
      >
       <label >RemainTime:<span id="timeRemain" href="#"></span></label>
   </div>
   <h1></h1>
   <hr>
  
   <div>
       <a id="displayCharSequence"></a>
   </div>
   <div>
       <input id="typed" class="box" placeholder="Type Here....." autofocus
          
           type="text">
           <div class="buttonPosition">
           <a class="button button2" disabled>Play</a>
           <a class="button button3" disabled>Stop</a>
           <a class="button button4">Pause</a>
           <div>
   </div>
  
</body>
</html>

Explanation / Answer

Hi,

As per your requirement design issue is resolved but for timer I need to understand what sort of game is this so that I am able to sync the timer with play, pause and stop button.

For play, pause, stop button and Type here text box you can update your code with below mention code, then all button will be showing as per your requirement.

<html>
<head>
<style>
.buttonPosition{
margin: -20px -50px;
position: absolute;
top: 450px;
left: 480px;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 8px;
}
.box:active{
width: 100%;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
.button2:active {
background-color: #e7e7e7;
box-shadow: 0 5px #008CBA;
transform: translateY(2px);
}
.button3:active {
background-color: #008CBA;
box-shadow: 0 5px #f44336;
transform: translateY(2px);
}
.button4:active {
background-color: #008CBA;
box-shadow: 0 5px #e7e7e7;
transform: translateY(2px);
}
.button2 {
//position:fixed;
//top: 400px;
// left: 300px;
background-color: #008CBA;
} /* Blue */
.button3 {
//position:fixed;
//top: 400px;
//left: 400px;
background-color: #f44336;
} /* Red */
.button4 {
//position:fixed;
//top: 400px;
//left: 500px;
background-color: #e7e7e7; color: black;
} /* Gray */
</style>
<script> //script starting tag
var displayedText = "";
var score = 0;
var INCREMENT = 10;
var DECREMENT = 5;
var playFlag = false;
var LEVEL = [];
LEVEL.push({NUM:1 , SEQ:'a'}); //assigning level 1-11 into array
LEVEL.push({NUM:1 , SEQ:'A'});
LEVEL.push({NUM:2 , SEQ:'a'});
LEVEL.push({NUM:2 , SEQ:'A'});
LEVEL.push({NUM:3 , SEQ:'aAa'});
LEVEL.push({NUM:3 , SEQ:'a#'});
LEVEL.push({NUM:4 , SEQ:'A#'});
LEVEL.push({NUM:4 , SEQ:'A#a'});
LEVEL.push({NUM:5 , SEQ:'AAa'});
LEVEL.push({NUM:5 , SEQ:'#Aa'});
LEVEL.push({NUM:6 , SEQ:'aA#a'});
var CURRENTLEVEL=LEVEL[0];//you can change the level here by changing index
//value upto 9
function play(){ //javascript function to play the game
playFlag=true;
display(); //calling the display function
}
function randomString(length, chars) {//assigning displaying elements
var mask = '';
if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz';
if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if (chars.indexOf('#') > -1) mask += '0123456789';
// if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*()_+-={}[]:";'<>?,./|\';
var result = '';
for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)];
return result;
}
function display(){ //function to display the charecters on the desktop
displayedText = randomString(CURRENTLEVEL.NUM, CURRENTLEVEL.SEQ);
document.getElementById('displayCharSequence').innerHTML = displayedText;
DisplayScore();
}
function incrementScore(){ //function for incrementing the score
score = score+INCREMENT;
}
function decrementScore(){ //function for decrementing the Score
if(score > 0)
score = score - DECREMENT;
else
score = 0;
}
function DisplayScore(){ //funtion for displaying the score
document.getElementById('score').innerHTML = score;
}
function clearTyped(){
document.getElementById('typed').value = "";
}
function check(obj){ //function for checking the object for play,pause,stop
var val = new String();
val = obj.value;
if(val == displayedText && playFlag){
incrementScore();
DisplayScore();
clearTyped();
display();
}
function startTimer(duration, display) { //function for time calculations
var start = Date.now(),diff,minutes,seconds;
function timer() {
diff = duration - (((Date.now() - start) / 1000) | 0);
minutes = (diff / 60) | 0;
seconds = (diff % 60) | 0;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = minutes + ":" + seconds;
if (diff <= 0) {
start = Date.now() + 1000;
}
};
timer();
setInterval(timer, 1000);
}
window.onload = function () { //function for displaying the time and load the time
var reqMinutes = 60 * 2,
display = document.querySelector('#timeRemain');
startTimer(reqMinutes, display);
};
}
</script>
</head>
<body>
<div
">
<label >Score:<a id="score" href="#">0000</a></label>
</div>
<div
>
<label >RemainTime:<span id="timeRemain" href="#"></span></label>
</div>
<!-- <h1></h1>
<hr> -->
  
<div>
<a id="displayCharSequence"></a>
</div>
<div>
<input id="typed" class="box" placeholder="Type Here....." autofocus

type="text">
<div class="buttonPosition">
<a class="button button2" disabled>Play</a>
<a class="button button3" disabled>Stop</a>
<a class="button button4">Pause</a>
<div>
</div>
  
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote