I am trying to add a script one of my page of my site but a error occouring while doing it. Actully i want to insert a prompt box before loading the page. I want the user insert his/her name in the prompt box and want to insert that name in the html coading of page. but as soon as i enter some name in the prompt box all the formatting of the page disappers like bg color and text color and every thing. here is my code
<html>
<head>
<script type="text/javascript">
function vaibhav()
{
var name=prompt("Please enter your name","Harry Potter")
if (name!=null && name!="")
{
document.write("Hello " + name + "! How are you today?")
}
}
</script>
</head>
<body onload="vaibhav()" value="Call function" bgcolor="#000000" text="#FFFFFF">>
</body>
</html>



Reply With Quote


Bookmarks