JS - Gettings the parent html name of the object which I assigned an action to

dcarlier
dcarlier Community Member Posts: 1
Hi,



First of all, thanks for taking the time to read this post.



I'm trying to create an animation option for lectora objects, first step is to make a list of the objects that i want to animate. My idea was to assign an action to an image in lectora.



That action is running a:

Show->GoTo->Webpage->javascript:getImageName(parameter)



I want to send along a parameter that contains the name of the image it is assigned upon.

Example hierarchy:

- Image4

= Action1



So Action1 will run something like getImageName(what is the parent? it is Image4).



Does anyone know how to retrieve the html name of its' parent in an action?



Thanks in advance!



David

Comments

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 599 eLearning ROCKSTAR Admin Team
    Hi,



    Not sure if this will help, but here are a few basics, which you might already know....



    You can view object's html names in their properties dialogs. To turn this on you need to click the preferences (the gears) on the File Tab. Then click the option to Show HTML published object names in object properties.



    Now if you look in the properties of Image 4 it might have HTML Name: image49



    For images if you want to get to the IMG tag then you would reference it in the DOM by image49.dCon



    It would be quite a bit harder to identify the parent of the action in JavaScript dynamically.



    There is another thread that shows how to set your name for the object to be the JavaScript name for the object:

    http://lectora.com/forum/showthread.php?t=12911



    Hope this helps!
  • michaelprescott
    michaelprescott Community Member Posts: 5
    I think this will help, http://stackoverflow.com/questions/403967/how-may-i-reference-the-script-tag-that-loaded-the-currently-executing-script, if you're able to apply the principle to Lectora native objects, like Images. I've successfully used this technique recently on External HTML Objects.