PDA

View Full Version : Javascript with Tab Content



twl2012
05-18-2012, 03:05 PM
I am using Tab Content script v2.2. I need to execute a very small Javascript function when a specific tab is clicked. I have tried the following without success (the script is not executed):

[CODE]
<ul id="flowertabs" class="shadetabs">
<li><a href="#" rel="tcontent1" class="selected">Description</a></li>
<li><a href="#" rel="tcontent2">Specifications</a></li>
<li><a href="#" rel="tcontent3">Includes</a></li>
<li><a href="#" rel="tcontent4" onClick="startMagnify()">Images/Video</a></li>
</ul>
[CODE]

Below is the Javascript function

[CODE]
<script type="text/javascript">
function startMagnify()
{
alert("magic start");
MagicMagnifyPlus.start();
}
</script>
[CODE]

Any help will be very much appreciated. YES, I am a novice.

ddadmin
05-18-2012, 11:51 PM
Warning: Please include a link to the DD script in question in your post, in this case, http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm . See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Simply move the onClick event handler from inside the <a> element to its parent <li> instead:



<ul id="flowertabs" class="shadetabs">
<li><a href="#" rel="tcontent1" class="selected">Description</a></li>
<li><a href="#" rel="tcontent2">Specifications</a></li>
<li><a href="#" rel="tcontent3">Includes</a></li>
<li onClick="startMagnify()"><a href="#" rel="tcontent4">Images/Video</a></li>
</ul>