tezread
12-05-2006, 12:03 PM
1) Script Title: Switch Menu
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...switchmenu.htm
3) Describe problem:
I am trying to adapt this approach so that the menu items are listed using a PHP query and when clicking a menu item the records relating to it are displayed. Perhaps this will best be demonstrated through a page on my website:
http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_list1.php
In my case I would like a list of quality systems to be the 'menu items' which are pulled from the database and when you click the menu item the details relating to it are 'expanded' - again querying the database.
Here is the current hard coded approach
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:600px;
padding:2px;
text-align:center;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="local" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}
function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction
if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
</script>
</p>
<p>
<!-- Keep all menus within masterdiv-->
<div id="masterdiv">
<div class="menutitle" onclick="SwitchMenu('sub1')">Balanced Scorecard</div>
<span class="submenu" id="sub1">
This approach takes the organisation’s strategy as the starting point and transforms it into a set of goals, targets and measures. It is an implementation tool which helps to sharpen up your organisation’s strategy using a balanced picture of your performance based on 4 critical areas: customers, internal processes, learning and growth, and financial.
Comment: Not yet much experience in the voluntary sector – but interesting. You’ll need to become familiar with the Scorecard concepts.
<a href="http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Balanced+Scorecard" target="">view</a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub2')">Charter Mark</div>
<span class="submenu" id="sub2">
This is the national standard of customer service excellence, which is open to all public sector organisations as well as voluntary organisations providing public services using 10% of more public funding, It applies to any organisation which provides services on a customer basis – whether you call them customers, clients or service users. It covers active engagement with customers, fairness, accessibility, choice, use of resources, improving opportunities and quality of life in communities.
Comment: Useful for developing a customer focused service ethos, and setting a standard which will help in competitive tendering for public funded services.
<a href = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Charter+Mark" target="">view</a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub3')">Code of Governance</div>
<span class="submenu" id="sub3">
This Code is for committees and boards of voluntary organisations – to guide the way they operate and make decisions and help them to act with integrity in an open and accountable way. Developed by the Governance Hub and endorsed by the Charity Commission, it is based on the principle of ‘Comply or Explain’. So while it is not a legal requirement, you should either conform or be able to explain why a particular point in the Code does not apply to you.
<br>
<br>
<strong>Comment</strong>: Because it is new (2006), national organisations are offering information and help to encourage use of the Code. It complements the National Occupational Standards for Trustees which is aimed at individual committee/board members, and would be helpful if you are using any other quality system.
<a href = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Code+of+Governance" target="">view</a>
</span> </p>
How can I incorporate these queries so they function like the switch menu on Dynamic?
Thanks in advance
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...switchmenu.htm
3) Describe problem:
I am trying to adapt this approach so that the menu items are listed using a PHP query and when clicking a menu item the records relating to it are displayed. Perhaps this will best be demonstrated through a page on my website:
http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_list1.php
In my case I would like a list of quality systems to be the 'menu items' which are pulled from the database and when you click the menu item the details relating to it are 'expanded' - again querying the database.
Here is the current hard coded approach
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:600px;
padding:2px;
text-align:center;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="local" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}
function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction
if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
</script>
</p>
<p>
<!-- Keep all menus within masterdiv-->
<div id="masterdiv">
<div class="menutitle" onclick="SwitchMenu('sub1')">Balanced Scorecard</div>
<span class="submenu" id="sub1">
This approach takes the organisation’s strategy as the starting point and transforms it into a set of goals, targets and measures. It is an implementation tool which helps to sharpen up your organisation’s strategy using a balanced picture of your performance based on 4 critical areas: customers, internal processes, learning and growth, and financial.
Comment: Not yet much experience in the voluntary sector – but interesting. You’ll need to become familiar with the Scorecard concepts.
<a href="http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Balanced+Scorecard" target="">view</a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub2')">Charter Mark</div>
<span class="submenu" id="sub2">
This is the national standard of customer service excellence, which is open to all public sector organisations as well as voluntary organisations providing public services using 10% of more public funding, It applies to any organisation which provides services on a customer basis – whether you call them customers, clients or service users. It covers active engagement with customers, fairness, accessibility, choice, use of resources, improving opportunities and quality of life in communities.
Comment: Useful for developing a customer focused service ethos, and setting a standard which will help in competitive tendering for public funded services.
<a href = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Charter+Mark" target="">view</a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub3')">Code of Governance</div>
<span class="submenu" id="sub3">
This Code is for committees and boards of voluntary organisations – to guide the way they operate and make decisions and help them to act with integrity in an open and accountable way. Developed by the Governance Hub and endorsed by the Charity Commission, it is based on the principle of ‘Comply or Explain’. So while it is not a legal requirement, you should either conform or be able to explain why a particular point in the Code does not apply to you.
<br>
<br>
<strong>Comment</strong>: Because it is new (2006), national organisations are offering information and help to encourage use of the Code. It complements the National Occupational Standards for Trustees which is aimed at individual committee/board members, and would be helpful if you are using any other quality system.
<a href = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Code+of+Governance" target="">view</a>
</span> </p>
How can I incorporate these queries so they function like the switch menu on Dynamic?
Thanks in advance