Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTML DOM Events
Message
De
06/02/2004 11:28:29
 
 
À
06/02/2004 09:26:00
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00874806
Message ID:
00874863
Vues:
19
Hi Alexander,

First thing to remember.
The method I uses, is to capture the URL from an "A" tag's HREF in the BeforeNavigate2 event. It comes in as parameter. If the URL is prefixed with "VFP:" (I purposely prefix the HREF link with it to identify a VFP call), I stripe the prefix off, and preform the remainder as command with a macro substitution.
PROCEDURE BeforeNavigate2
LPARAMETERS pdisp, url, flags, targetframename, postdata, headers, cancel

IF LEFT(UPPER(m.url),4)="VFP:"
	m.Cancel = .T.             && Stop WebBrowser from continueing after method ends.
	m.url = ALLTRIM(SUBSTR(m.url,5))
	&url
ENDIF
Now to use this with the OnClick event on the HTML page.

On the HTML, place anywhere a "A" tag, as so.
<A HREF="" ID=CMD NAME=CMD></A>
It will not be visible to the user.

In the OnClick reference, do something like this.
<Span OnClick="javascript:CMD.href='VFP:MessageBox([That felt good.])';CMD.click();">Click Me</a>
Now, when the user clicks the "Click Me" on the page, the CMD's Href is change to the "VFP:..." statement, and then the CMD tag is clicked. This calls the BeforeNavigate2 event, and the VFP code is executed.

Check out in the download section Simplest TreeView for VFP download#21595. It uses this same techique.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform