how to perform a javascript action associated with an image?

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
unworldly1
Posts: 1
Joined: Tue Jul 15, 2008 4:18 pm

how to perform a javascript action associated with an image?

Post by unworldly1 » Tue Jul 15, 2008 4:28 pm

Hi,

I found iMacros for Firefox today, and I am amazed! I am however having trouble with some pages using javascript.

The action I cannot get to perform on replay is a mouse click of an image. The image has a javascript event associated with it:

javascript:addItemEntry(document.assignDomForm.ASSIGNEDDOMAINS, document.assignDomForm.AVAILABLEDOMAINS, 10000);

If I click the image, it is not found when replaying the macro. If I do xy click mode then nothing happens on replay.

URL click record also gives error:
Error# 801 in line:8 , TAG not found

TYPE=IMG
ATTR=HREF:javascript:addItemEntry(document.assignDomForm.ASSIGNEDDOMAINS,%20document.assignDomForm.AVAILABLEDOMAINS,%2010000);

any help would be HUGELY appreciated, as this will save me hours of time if I can get it to work!

thx.
juzamjedi
Posts: 17
Joined: Tue Jun 24, 2008 3:19 am

Re: how to perform a javascript action associated with an image?

Post by juzamjedi » Tue Jul 22, 2008 4:40 am

Hello,

I have a similar problem as this. iMacros fails to execute the javascript action in a web page for me. I know what javascript function I need to call, but how do we make this happen in an iim macro?
juzamjedi
Posts: 17
Joined: Tue Jun 24, 2008 3:19 am

Re: how to perform a javascript action associated with an image?

Post by juzamjedi » Tue Jul 22, 2008 8:01 am

Hello unworldly1,

After re-reading the wiki and trying many variations I finally solved my own problem. Maybe part of my solution will apply to you as well.

In my case there were 2 key data points that I was missing:
#1. "MOUSEOVER" event trigger. This is an option for the CONTENT parameter in a tag and seems to trigger certain javascript functions.

#2. After some trial and error I realized that iMacros had found the tag for the lowest level possible match for what I clicked during the macro recording (in my case an EM tag). However, the MOUSEOVER event trigger was located 1 level higher in a SPAN tag element instead of the EM. After I manually changed the macro to call the SPAN tag the javascript function executed as if I had clicked on the button.

Devs - #1 is probably something that newbies like me could / should read through the manual and find. But #2 seems like something that you might want to review in a future release?
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: how to perform a javascript action associated with an image?

Post by Tech Support » Tue Jul 22, 2008 5:34 pm

juzamjedi, thanks for the detailed solution! That is very helpful. I added a link to this post directly from the wiki.

About suggestion #2: We will look into this further.
Post Reply