Results 1 to 3 of 3
Thread: partially working script
- 03-27-2012, 09:02 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 2
- Rep Power
- 0
partially working script
Hello guys and gals,
Im new to javascript, and im creating a site that requires a few scripts on the same page, however, on seems to return strange results based on its identifier, sometimes working fully, sometimes for one item or the first few.
web address is
Zaks Custom Cues | Zaks Custom Cues | Quality Handcrafted Pool and Snooker Cues
you will see on tab 'main splice' all toggle images work and as do their targets - go to tab 'four splice' and you will see the first item works only. (targets not loaded yet for this tab) and same again for the partially finished 'badges' tab.
changing the identifier from groupone to grouptwo switches these states and sometimes returns strange results like the first 9 or 10 working only.
the site is based in php, on a xoops platform, and this problem has been killing me for 5 days straight now!
the script seems simple enough
and the output code for first two entries of the working tab...Java Code:// toggle script function toggleany(here,suffix,imagenum) { var group = document.getElementById("group" + suffix); var Sets = group.getElementsByTagName("a"); for ( x = 0 ; x < Sets.length ; ++x ) { var alink = Sets[x]; /* get reference to one a tag */ var images = alink.getElementsByTagName("img"); /* find images in that tag */ /* hide or show the select.png depending on which clicked */ document.getElementById("cbselectortoggle" + suffix + x).style.visibility = ( x == imagenum ) ? "visible" : "hidden"; /* ditto for the contentDiv that matches suffix and imagenum */ document.getElementById("contentDiv" + suffix + x).style.display = ( x == imagenum ) ? "block" : "none"; } }
and for the non working codeXML Code:<ul id="mainsplice" class="hide"> <li> <div id="groupop1"> <div class="cbselector" id="popup"> <a onclick="javascript:toggleany(this,'op1',0 ); emailone='variableOne0';"> <img class="toggleimage" id="cbselectortoggleop10" src="images/cb/select.png" style="visibility: hidden;" /> <img id="cbtimbericon" src="images/cb/timbers/icons/1.png" /> <em>Gabon Ebony</em> <span> <em class="spanem">Gabon Ebony</em> <strong>Diospyros crassiflora</strong> <img src="images/cb/timbers/icons/1.png" /> <small>From equatorial Africa, Gabon Ebony is usually found in wet lowlands near rivers and swaps. Devoid of color, Gabon Ebony has ink black with lighter streaks. Only a small percentage of Ebony (three to five percent) produce the highest quality jet black Ebony. Most pieces contain 50-70% sapwood with d....</small> <b>Hardness = 3220</b> </span> </a> </div> <div class="cbselector" id="popup"> <a onclick="javascript:toggleany(this,'op1',1 ); emailone='variableOne1';"> <img class="toggleimage" id="cbselectortoggleop11" src="images/cb/select.png" style="visibility: hidden;" /> <img id="cbtimbericon" src="images/cb/timbers/icons/2.png" /> <em>Purpleheart</em> <span> <em class="spanem">Purpleheart</em> <strong>Peltogyne paniculata</strong> <img src="images/cb/timbers/icons/2.png" /> <small>A brilliantly colored hardwood from South America, Purpleheart is very popular for its deep purple color. Ideal for inlay, marquetry, and other fine articles. Occasionally the trees produce either fiddleback or a ropey mottled curl from interlocked grain. The color is a pale brown when freshly cut, ....</small> <b>Hardness = 2710</b> </span> </a> </div> <div id="spanclear"></div> </div> </li> </ul>
thank you advanceXML Code:<ul id="foursplice" class="hide"> <li> <div id="groupicons"> <div class="cbselector" id="popup"> <a onclick="javascript:toggleany(this,'icons','0' ); emailone='variableOne0';"> <img class="toggleimage" id="cbselectortoggleicons0" src="images/cb/select.png" style="visibility: hidden;" /> <img id="cbtimbericon" src="images/cb/timbers/icons/1.png" /> <em>Gabon Ebony</em> <span> <em class="spanem">Gabon Ebony</em> <strong>Diospyros crassiflora</strong> <img src="images/cb/timbers/icons/1.png" /> <small>From equatorial Africa, Gabon Ebony is usually found in wet lowlands near rivers and swaps. Devoid of color, Gabon Ebony has ink black with lighter streaks. Only a small percentage of Ebony (three to five percent) produce the highest quality jet black Ebony. Most pieces contain 50-70% sapwood with d....</small> <b>Hardness = 3220</b> </span> </a> </div> <div class="cbselector" id="popup"> <a onclick="javascript:toggleany(this,'icons','1' ); emailone='variableOne1';"> <img class="toggleimage" id="cbselectortoggleicons1" src="images/cb/select.png" style="visibility: hidden;" /> <img id="cbtimbericon" src="images/cb/timbers/icons/2.png" /> <em>Purpleheart</em> <span> <em class="spanem">Purpleheart</em> <strong>Peltogyne paniculata</strong> <img src="images/cb/timbers/icons/2.png" /> <small>A brilliantly colored hardwood from South America, Purpleheart is very popular for its deep purple color. Ideal for inlay, marquetry, and other fine articles. Occasionally the trees produce either fiddleback or a ropey mottled curl from interlocked grain. The color is a pale brown when freshly cut, ....</small> <b>Hardness = 2710</b> </span> </a> </div> <div id="spanclear"></div> </div> </li> </ul>
steve
- 03-27-2012, 09:14 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
Re: partially working script
You must've taken the wrong exit, because this is a Java forum; Javascript and Java are two completely different languages ...
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-27-2012, 09:28 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Script not working with IE7
By sfphoto in forum New To JavaReplies: 1Last Post: 12-13-2010, 05:08 PM -
JTable update only partially successful
By assel in forum AWT / SwingReplies: 0Last Post: 12-02-2010, 11:37 PM -
Fill in rectangle partially (clip?¿)
By OBLITERATOR in forum New To JavaReplies: 1Last Post: 03-07-2010, 04:59 AM -
JSP partially renders sometimes
By lisalu22 in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 02-23-2010, 05:45 PM -
JSP send mail script not working.
By profuse in forum Java AppletsReplies: 1Last Post: 05-27-2008, 06:37 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks