On a page I have a table and one of the rows includes hidden divs in certain cells. There is a visible checkbox, which toggles the visibility and some other aspects of the display for the various divs.
Sample code in the table:
This script is in the head section:
This works fine on the page. But once the page containing this is loaded into an iframe, the onclick events no longer fire. Same problem in Chrome, Firefox, Safari and MSIE.
Sample code in the table:
Code:
<tr> <td style="width: 120px;"><div id="item1" style="width: 116px;" class="label">Cold Water</div></td> <td style="width: 20px;"><div style="cursor: pointer;" align="center"><a onclick="toggle('PFP1A','PFP1B','PFP1C','PFP1D','PFP1E'); toggletexton('item1');"><input class="checkbox" name="checkbox" type="checkbox"></a></div></td> <td style="width: 60px;" align="right"><div id="PFP1A" style="width: 41px;" class="label">Quantity</div></td> <td style="width: 30px;"><div id="PFP1B" style="width: 24px;"><input style="width: 20px;" value="combobox2" name="combobox" class="box"></div></td> <td style="width: 80px;"><div id="PFP1C"></div></td> <td style="width: 60px;"><div id="PFP1D"></div></td> <td style="width: 90px;"><div id="PFP1E" style="width: 90px;"></div></td> </tr>
Code:
function toggle() { for ( var i=0; i < arguments.length; i++ ) { $(arguments[i]).style.display = ($(arguments[i]).style.display != 'none' ? 'none' : 'block' ); } } function toggletexton() { for ( var i=0; i < arguments.length; i++ ) { $(arguments[i]).style.color = ($(arguments[i]).style.color != '#aaaaaa' ? '#aaaaaa' : '#000000'); $(arguments[i]).style.fontWeight = ($(arguments[i]).style.fontWeight != 'bold' ? 'bold' : 'normal'); $(arguments[i]).style.fontStyle = ($(arguments[i]).style.fontStyle != 'normal' ? 'normal' : 'oblique'); } }
Comment