Hi,
I've created a HTML+VBScript page for a Multiplication Table. So, my page has two input text boxes and one input submit button.. When the program runs, its suppose to open in Internet Explorer and display a page with 2 input text boxes and a submit "Generate Table" button. When working correctly, there is only one error for if the start value > end value. Then a page is suppose to display my multiplication table.
So, in the 1st stages of my code I only have a message box that displays a message and it works fine when I run it, but when I insert the code for the multiplication table and try to run it, nothing happens. This is my first HTML VBScript application so I'm not sure what to look for. I've followed closely what the instructor had in the hand out (and I even re-started the project over) but I am unable to figure out why my code won't work.
Help please!
I've created a HTML+VBScript page for a Multiplication Table. So, my page has two input text boxes and one input submit button.. When the program runs, its suppose to open in Internet Explorer and display a page with 2 input text boxes and a submit "Generate Table" button. When working correctly, there is only one error for if the start value > end value. Then a page is suppose to display my multiplication table.
So, in the 1st stages of my code I only have a message box that displays a message and it works fine when I run it, but when I insert the code for the multiplication table and try to run it, nothing happens. This is my first HTML VBScript application so I'm not sure what to look for. I've followed closely what the instructor had in the hand out (and I even re-started the project over) but I am unable to figure out why my code won't work.
Help please!
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 220px;
}
</style>
<script language="vbscript" type="text/vbscript">
// <![CDATA[
Sub Submit1_onclick()
Dim M, N As Integer
Dim I, J As Integer
M = CInt(StartTextBox.Text)
N = CInt(EndTextBox.value)
If M > N Then
MsgBox "Ending value should eb greater than the startiing value!" & vbCrlf & " Please enter another value."
Exit Sub
End If
document.write("<HTML>")
document.write("<head><title>Mulitplication Table " & M & " x " & N & "</title></head>")
document.write("<body>")
document.write("<h1>Multiplication Table" & M & " x " & N & "</h1>")
document.write("<h2>By Sierra Ray</h2>")
document.write("<hr style=""color:red"" />")
document.write("<table border=""3"">")
document.write("<tr>")
document.write("<th> </th>")
For I = M To N
document.write("<th>" & I & "</th>")
Next
For I = M To N
document.write("<tr>")
document.write("<th>" & I & "</th>")
For J = M To N
document.write("<td>" & I * J & "</td>")
Next
document.write("</tr>")
Next
document.write("</table>")
document.write("</body>")
document.write("</HTML>")
' MsgBox("Thanks for sticking around!")
End Sub
// ]]>
</script>
</head>
<body>
<table class="style1">
<tr>
<td class="style2">
Start</td>
<td>
<input id="StartText" type="text" /></td>
</tr>
<tr>
<td class="style2">
End</td>
<td>
<input id="EndText" type="text" /></td>
</tr>
<tr>
<td class="style2">
</td>
<td>
<input id="Submit1" type="submit" value="Generate Table" /></td>
</tr>
</table>
</body>
</html>