Jump to content

Set javascript var value


Recommended Posts

#include <IE.au3>

Dim $oIE, $oScripts, $oScript

$oIE = _IECreate('http://www.google.com/')
ConsoleWrite('a variable is: ' & IEEval($oIE, 'a') & @LF)
;$oScript = $oIE.document.scripts(2)
;ConsoleWrite(_IEPropertyGet($oScript, 'innerhtml') & @LF)
;IEEval($oScript, 'a=123')
IEEval($oIE, 'a=123')
ConsoleWrite('a variable is: ' & IEEval($oIE, 'a') & @LF)

; Thanks DaleHohm for the code.
Func IEEval($o_object, $s_eval)
    Return $o_object.document.parentwindow.eval($s_eval)
EndFunc   ;==>IEEval

Edited by Authenticity
Link to comment
Share on other sites

Hi, heh sorry for not replying here. I didn't know about it, it's from another thread the DaleHohm posted. It's not documented here yet but I believe that the Window object exposes it as well as the execScript method which, if I understand it correctly, does the same as eval.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...