Hi all,
I am using javascript in my cake view page and trying to call that functions they are not working properly please help me.
my code is
<html>
<head>
<script type="text/javascript" language="javascript">
window.onload = makeCollapsible;
/* CLOSED_IMAGE - the image to be displayed when the sublists are closed
* OPEN_IMAGE - the image to be displayed when the sublists are opened
*/
CLOSED_IMAGE='img/plus.jpg';
<?php echo $html->image('plus.jpg');
?>
OPEN_IMAGE='img/minus.jpg';
/* makeCollapsible - makes a list have collapsible sublists
*
* listElement - the element representing the list to make collapsible
*/
function makeCollapsible(){
listElement = document.getElementById('computers');
// removed list item bullets and the sapce they occupy
listElement.style.listStyle='none';
listElement.style.marginLeft='0';
listElement.style.paddingLeft='0';
// loop over all child elements of the list
var child=listElement.firstChild;
while (child!=null){
// only process li elements (and not text elements)
if (child.nodeType==1){
// build a list of child ol and ul elements and hide them
var list=new Array();
var grandchild=child.firstChild;
while (grandchild!=null){
if (grandchild.tagName=='OL' || grandchild.tagName=='UL'){
grandchild.style.display='none';
list.push(grandchild);
}
grandchild=grandchild.nextSibling;
}
// add toggle buttons
var node=document.createElement('img');
node.setAttribute('src',CLOSED_IMAGE);
node.setAttribute('class','collapsibleClosed');
node.onclick=createToggleFunction(node,list);
child.insertBefore(node,child.firstChild);
}
child=child.nextSibling;
}
}
/* createToggleFunction - returns a function that toggles the sublist display
*
* toggleElement - the element representing the toggle gadget
* sublistElement - an array of elements representing the sublists that should
* be opened or closed when the toggle gadget is clicked
*/
function createToggleFunction(toggleElement,sublistElements){
return function(){
// toggle status of toggle gadget
if (toggleElement.getAttribute('class')=='collapsibleClosed'){
toggleElement.setAttribute('class','collapsibleOpen');
toggleElement.setAttribute('src',OPEN_IMAGE);
}else{
toggleElement.setAttribute('class','collapsibleClosed');
toggleElement.setAttribute('src',CLOSED_IMAGE);
}
// toggle display of sublists
for (var i=0;i<sublistElements.length;i++){
sublistElements[i].style.display=
(sublistElements[i].style.display=='block')?'none':'block';
}
}
}
function edit_store(sel_stores, grp_name, grp_id)
{
document.getElementById('selected_stores').value = sel_stores;
document.getElementById('group_name').value = grp_name;
document.getElementById('sgid').value = grp_id;
document.getElementById('idd').value = '153';
document.getElementById('store_grid').submit();
}
</script>
<script type="text/javascript" language="javascript">
function create_new_group()
{
document.getElementById('idd').value = '153';
document.getElementById('store_grid').submit();
}
</script>
<strong>
<?php echo $html->link('Gauteng Division', '#',
array(
'class'=>'url2_font',
'font-fomily'=>'Verdena',
'onclick'=>'edit_store('3_4_',
'Gauteng Division', '3'));
?>
</strong>
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Sunday, April 25, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment