18.01.2013 Views

Visual Basic 6 Client/Server Programming Gold Book:Table of ...

Visual Basic 6 Client/Server Programming Gold Book:Table of ...

Visual Basic 6 Client/Server Programming Gold Book:Table of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Brief Full<br />

Advanced<br />

Search<br />

Search Tips<br />

To access the contents, click the chapter and section titles.<br />

<strong>Visual</strong> <strong>Basic</strong> 6 <strong>Client</strong>/<strong>Server</strong> <strong>Programming</strong> <strong>Gold</strong> <strong>Book</strong><br />

(Publisher: The Coriolis Group)<br />

Author(s): Michael MacDonald and Kurt Cagle<br />

ISBN: 1576102823<br />

Publication Date: 10/01/98<br />

Search this book:<br />

Previous <strong>Table</strong> <strong>of</strong> Contents Next<br />

This example actually demonstrates two concepts: adding JavaScript into a VB<br />

application and calling a <strong>Visual</strong> <strong>Basic</strong> function from JavaScript. The first<br />

concept is straightforward—just because VB hooks into the Internet Explorer<br />

event queue doesn’t mean that you can’t still run scripts in Web pages. The<br />

script here illustrates that concept quite well. In general, if you have both a<br />

JavaScript event handler and a <strong>Visual</strong> <strong>Basic</strong> event handler for the same event,<br />

the JavaScript will be performed first.<br />

This is demonstrated by the second concept—you can call a VB function from<br />

JavaScript. There are two event handlers for the Enter image’s onclick event.<br />

The JavaScript handler calls a JavaScript function called Notify. Notify in turn<br />

references the DHTMLPage1 object, which has defined a GetInfo routine.<br />

That routine returns a string indicating when the button was pressed to the<br />

nearest second, which is displayed in a below the button. After you get<br />

past the ActiveX alert (which will be covered momentarily), then the <strong>Visual</strong><br />

<strong>Basic</strong> onclick event is called.<br />

Although there is a lot that can be done with image manipulation in <strong>Visual</strong><br />

<strong>Basic</strong>, in most circumstances you will be better <strong>of</strong>f encapsulating mechanical<br />

functionality (such as buttons) in JavaScript code. By and large, these don’t<br />

need to be secured anyway. The danger <strong>of</strong> people looking through your source<br />

code comes in exposing your business logic, not multimedia functions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!