I am looking to trigger some Javascript through the “do JavaScript” command for Safari. The code is normally triggered via an onclick=“” in an html tag.
<a id='user38002' class='user' onclick="CSF.Login.select_user('greg zim');">
<img class='default_icon' src='login_user_icon.png' alt='user icon'/>
<span class='user_name'>gzim</span>
</a>
I would like to trigger the same function with something like
on doJavaScript()
tell application "Safari"
activate
tell window 1
do JavaScript "CSF.Login.select_user('greg zim');"
end tell
end tell
end doJavaScript
doJavaScript()
However that does not seem to work. Am I doing something obviously wrong?
Thanks in advance!
Browser: Safari 5.0.6 (5533.22.3)
Operating System: Mac OS X (10.6)