Ive been making a online turn based game in my free time, and i was wondering how to make it show up that ive bought the weapon. after i click submit its suppose to say you have 1 weapons. But its not working and how can i tell it were i want it to display it at. heres my code. sorry if i explained that bad. <html> <body background="http://www.script-design.com/img/home0/2.jpg"> <script type="text/javascript"> function Buy() { var name=prompt("weapon?","1") if (name!=null && name!="") { document.write("You have" + name + "Weapons") } } </script> <input type="text" name="prompt" value="1"> <input type="submit" name="prompt" value="Submit"> </body </html>
you'll want to use <input type="button" onclick="Buy();" /> Code (markup): As far as getting it to show up where you want, I suggest making an empty tag like. <span id="myID"></span>[code] Then instead of document.write use [code]document.getElementById("myID").innerHTML = "Your text goes here"; Code (markup):