PDA

View Full Version : pop-up boxes?


wsofia
09-16-2002, 01:51 PM
hi,
how do i write the code for 'prompt boxes'?
i've tried writing the below code but it won't work.

<script language="JavaScript">
var vName=prompt("What's your name?",".");
alert("Hi " +vName+ "!");
</script>

<script language="JavaScript">
document.write("Welcome to Webverse " +vName+ ".")
</script>

a runtime error window appears everytime i refresh the page. what do i do next?

A1ien51
09-16-2002, 07:58 PM
The problem is just the nature of the script....
try this


<script language="JavaScript">
function Hello(){
var vName=prompt("What's your name?",".");
alert("Hi " +vName+ "!");
document.write("Welcome to Webverse " +vName+ ".")
}
window.onload=Hello;
</script>