I have to create a simple bookstore style site. My site needs to ask for how many books you want, and then multiply that number by 9.95 which is the price of the book, and then add 4.95 for shipping. It just simply needs to ask for how many books you want. and then output that number in a message box. It needs a button to initiate the book sale.
this is what i have so far.
<html>
<head>
<p style="font-size:30px">Welcome to Artis' Book Collection</p>
<script type="text/vbscript">
Option Explicit
sub ValNumber()
dim number
dim answer
dim books
number = InputBox("How many books do you want?")
answer = isNumeric(number)
'add numbers
answer = number * 9.95
msgBox number & " * " & 9.95 " - " & answer
'Depending on answer display the appropriate message
if answer = true then
alert("Your Total is: answer")
else
alert("Sorry you did not enter a number")
end if
end sub
</script>
</head>
<body>
<b>
This page will help you to order some of my fantastic books.
When prompted enter in the book title and the number of books you wish to order.
You will then see your total cost.
<br>
<br>
To get started click on the Book Sale Button
</b><br>
<button onclick="ValNumber()">Is Number?</button>
</body>
</html>
any help you can assist me with will be appreciated. i'm not very good at this so explaining is needed.
Question
Tumble
I have to create a simple bookstore style site. My site needs to ask for how many books you want, and then multiply that number by 9.95 which is the price of the book, and then add 4.95 for shipping. It just simply needs to ask for how many books you want. and then output that number in a message box. It needs a button to initiate the book sale.
this is what i have so far.
<html> <head> <p style="font-size:30px">Welcome to Artis' Book Collection</p> <script type="text/vbscript"> Option Explicit sub ValNumber() dim number dim answer dim books number = InputBox("How many books do you want?") answer = isNumeric(number) 'add numbers answer = number * 9.95 msgBox number & " * " & 9.95 " - " & answer 'Depending on answer display the appropriate message if answer = true then alert("Your Total is: answer") else alert("Sorry you did not enter a number") end if end sub </script> </head> <body> <b> This page will help you to order some of my fantastic books. When prompted enter in the book title and the number of books you wish to order. You will then see your total cost. <br> <br> To get started click on the Book Sale Button </b><br> <button onclick="ValNumber()">Is Number?</button> </body> </html>any help you can assist me with will be appreciated. i'm not very good at this so explaining is needed.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts