PDA

View Full Version : html, why doesnt it work if i make an html file?


Marky
04-20-2007, 11:20 AM
so if i write javascript to display a prompt box at the click of a buttonand name it go.html why doesnt it work. it says error on page, but i do have the latest version of java6? why does it say error on page? what do i need to download. this is something like i tried to do.(not a button tho) function disp_prompt() var name=prompt("Please enter your name","Harry Potter") if (name!=null && name!="") { document.write("Hello " + name + "! How are you today?") }

Answerz
04-20-2007, 12:42 PM
Always good to have the lastest java. Your code looks ok.

PowZer
04-20-2007, 01:35 PM
JavaScript doesn't depend on the Java Runtime Environment don't worry about it. The problem is that you didn't put brackets around your function. function disp_prompt(){var name=prompt("Please enter your name","Harry Potter")if (name!=null && name!=""){document.write("Hello " + name + "! How are you today?")}}