Jump to content
Sign in to follow this  
ivan

Execute a web page's javascript

Recommended Posts

ivan

Oops. Forgot the first paragraph.

I've seen a good dozen times in the help and support forum people asking how to execute javascript functions in a web page. I've already done this using htas, but never really managed to solve in plain html.

The example should illustrate the HOW.

The one thing that I've not been able to do is to get the return values or objects from functions, only through htas as shown in Dynamic html in au3, manipulate javascript objects in au3

#include <IE.au3>

$Html = '<html>' & @CRLF _
        &'<head>' & @CRLF _
        &'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">' & @CRLF _
        &'<title></title>' & @CRLF _
        &'<meta name="description" content="">' & @CRLF _
        &'<meta name="keywords" content="">' & @CRLF _
        &'<meta name="author" content="iperezm@interactive.net.ec">' & @CRLF _
        &'<meta name="generator" content="AceHTML 5 Freeware">' & @CRLF _
        &'<script type=text/javascript>' & @CRLF _
        &'function JsMsgBox(pMsg){' & @CRLF _
        &'alert(pMsg);' & @CRLF _
        &'}' & @CRLF _
        &'</script>' & @CRLF _
        &'</head>' & @CRLF _
        &'<body>' & @CRLF _
        &'Time to get som..' & @CRLF _
        &'</body>' & @CRLF _
        &'</html>'
$oIE=_IECreate()
_IEDocWriteHTML ( $oIE, $Html )
$oIE.document.parentwindow.execScript('JsMsgBox("beer");', 'javascript')
Edited by ivan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.