I'm trying to have VB6 write an html file during run-time, with some
VBScript functionality. The intent is to display images based on the
current record within the program - using a WebBrowser - plus some
buttons to dynamically resize the image.
I have gotten almost everything to work - I put in a function to
simply disable the right-click option of the browser, but none of the
other functions work.
If I copy the source data out of the WebBrowser control and open it in
IE6 - everything works as it is supposed to, but not within the
WebBrowser as an object in VB6...
Obviously the control supports vbscript because the right-click works.
Any ideas on what I am doing wrong:
<html>
<head>
<title>C4P Image</title>
<SCRIPT type ="text/vbscript">
<!--
Option Explicit
dim myWidth, myHeight
Sub Startup()
myWidth = Document.forms("myForm").All.item("imgTarget").wid th
myHeight = Document.forms("myForm").All.item("imgTarget").hei ght
End Sub
Sub cmdShrink_OnClick()
Document.forms("myForm").All.item("imgTarget").wid th =
Document.forms("myForm").All.item("imgTarget").wid th *0.5
Document.forms("myForm").All.item("imgTarget").hei ght =
Document.forms("myForm").All.item("imgTarget").hei ght * 0.5
End Sub
Sub cmdGrow_OnClick()
Document.forms("myForm").All.item("imgTarget").wid th =
Document.forms("myForm").All.item("imgTarget").wid th *2
Document.forms("myForm").All.item("imgTarget").hei ght =
Document.forms("myForm").All.item("imgTarget").hei ght * 2
End Sub
Sub cmdReset_OnClick()
Document.forms("myForm").All.item("imgTarget").wid th = myWidth
Document.forms("myForm").All.item("imgTarget").hei ght =
myHeight
End Sub
Sub CatchMouseDown()
if Window.event.button = 2 Then
Alert("right-click off")
End If
End sub
-->
</SCRIPT>
</head>
<body onMouseDown="CatchMouseDown()" onload = "Startup" >
<form name = "myForm" >
<table CELLSPACING="0" CELLPADDING="0" VALIGN="CENTER"
WIDTH="100%" HEIGHT="100%" BORDER="0">
<tr><td align="center">
<table id="container" CELLSPACING="0" CELLPADDING="0"
VALIGN = "CENTER" WIDTH="90%" HEIGHT="90%" BORDER="0">
<tr><td>
<p align="center"><img border="0" src="picture.jpg"
loop = "infinite" width="120" height="43" name = "imgTarget"></p>
</td></td>
</table>
<p align = "center">
<input type = "button" value = "Smaller" name =
"cmdShrink" />
<input type = "button" value = "Larger" name = "cmdGrow"
/>
<input type = "button" value = "Reset" name = "cmdReset"
/>
</p>
</td></tr>
</table>
</form>
</body>
</html>