Hi guys, I need to create a HTML button inside a VB script, but getting an error. To keep things simple I have included two snippets that I'm using. The first snippet does not work. The second snippet works.
For ease of reading, I've omitted all the metadata stuff at that heads up the beginning of each html script.
Snippet #1
This produces the following error message:
Line:1
Char:1
Error: Object expected
Code:0
Snippet #2
If anybody has got any ideas why snippet #1 dosen't work I would be grateful.
Thanks in advance guys.
For ease of reading, I've omitted all the metadata stuff at that heads up the beginning of each html script.
Snippet #1
Code:
<title>Untitled Document</title>
</head>
<body>
<input type="button" value="bye" onclick="test()">
<script language="vbscript">
'when the button is inside a routine (sub or function) it dosent work.
Sub test
document.write "<input type=""button"" value=""hello"" onclick=""hellome()"">"
End sub
Function hellome
Msgbox("hey baby!!!")
End Function
</script>
</body>
</html>
Line:1
Char:1
Error: Object expected
Code:0
Snippet #2
Code:
<title>Untitled Document</title>
</head>
<body>
<script language="vbscript">
'when the button is outside a routine (sub or function) it works.
document.write "<input type=""button"" value=""hello"" onclick=""hellome()"">"
Function hellome
Msgbox("hey baby!!!")
End Function
</script>
</body>
</html>
If anybody has got any ideas why snippet #1 dosen't work I would be grateful.
Thanks in advance guys.