Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFLAYOUTAREA and javascript and innerHTML

New Here ,
Dec 19, 2013 Dec 19, 2013

Ok, this is a little complicated and it is not necessary limited to ColdFusion.

(And seeing's how there are so few replies these days here, I'll cross post in various forums!)

Here goes.

I have a cflayout with several cflayoutareas, and nested cflayouts.  In some of them I have a photos tab.

In those photo tabs, I call a custom tag that displays a gallery of photos, dislays the primary one and offers thumbnails.  Click on a thumbnail

and a Javascript function (changeImage) uses htmlid.innerHTML=newpic.

It works as expected.  Perfectly!

EXCEPT WHEN more than one Photo tab has images in it!

The javascript function seems to get confused which cflayout tab it is in?  Or which "instance" it is using?

Also each "tab" has its own javascript function, so ... each redundant js function cancels each other out?

So ... I went and ...

- commented out the JS function in the custom tag. 

- copied it to the shell of my web site so it's ALWAYS there for any photo custom tag to find; but only one of them.

- added what I'll call an instance ... when I call the photo custom tag added a unique parameter I called window with an ID in it.  Changed the <span id="photo"> to <span id="#attributes.window#">

and when calling the javascript added  a href="javascript:changeImage'#var1#', '#var2#', '#var3#', '#attributes.window#">

- then in the shell added window to the () of the call

- I then dump all the values ... in the js function.

- all are ok, it gets the window value, the proper image name and does a window.innerHTML.newpic;  just fine.

only there's no change onscreen.

If you have followed thus far, THANKS! 

How do I get the javascript to "find" the right cflayoutarea or is that even the problem?

Thanks a million!

423
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources