#javascript not working

1 messages · Page 1 of 1 (latest)

opal adder
#

Hello everyone please i need your help figuring out what’s wrong with my code.it doesn’t show me any errors but the javascript doesn’t work(display) on the browser what it should .here’s the code

<!DOCTYPE html>
<html>
<style>
body {
background:blue;
animation-name:loopiii;
animation-duration:10s;
}
@keyframes loopiii{
0% {background-color:purple;)}
10% {background-color:yellow;)}
20% {background-color:green;}
30% {background-color:purple;}
40% {background-color:cyan;}
50% {background-color:yellow;}
60% {background-color:red;}
70% {background-color:brown;}
80% {background-color:green;}
90% {background-color:orange;}
95% {background-color:blue;}
1453% {background-color:red;}
}
</style>
<body>
<script>
function main() {
//take flight number and its status
var flightNumber = readLine();
var flightStatus = readLine();

var flight1;
//assigns a flight object to flight1 variable
 var flight1=new Flight(flightNumber,flightStatus);

//output
document.write('The flight ' + flight1.number + ' is ' + flight1.status)

}

function Flight(flightNumber, status) {
// the constructor
this.number =flightNumber;
this.status =status;
};

    </script>

</body> 

</html>

simple kelp
#

you've gotta call your main function if you want it to run, Javascript doesn't automatically run main like Java would

#

readline is also a node function and not a function you can use in browser

#

you probably want to use prompt instead

opal adder
#

Thank for your help

#

How do I call the main function

simple kelp
#

you don't need to write your code in the main function, you can just stick it in the <script> tag without the function wrapping it