Hello,
I wrote my first program, and it opens ok, but when I click on the button, nothing happens. To me, everything looks good, but obviously, other than spelling and punctuation, I don't know what to look for.
Here is what I have:
That's the whole program.Code:<!DOCTYPE html> <html> <head> <script> /* This is the function that gets called when the user clicks the button on the main page */ function displayAnswer () { document . write(“Just 24 1-hour lessons!”); } </script> </head> <body> <h1>My First Program</h1> <p id=“demo”>How long will it take for me to learn to program?</p> <button type=“button” onclick=“displayAnswer ()”>How many hours?<button/button> </body> </html>
The <button> should open a new window with the reply "just 24 1-hour lessons".
I don't know what brackets {} or parentheses () are for, and sometimes its hard to tell if there is a space in a code, or not.
Also, I tried to enable the Apple Safari Debugger, according to online directions, but I guess I don't know enough about "Terminal" to get it going.
So, my main question is, if it's not a blatant typo, such as <buton>, then what else stops the program in its tracks?
Thank you,
David Paris
Ann Arbor



Reply With Quote

