Help please; getting desperate
Posted: Sat Jun 20, 2009 12:00 pm
I apologize in advance for being a little "thick" but I've been working on this script for 2 days straight, tried literally dozens of tips from the inet and forums and still hitting the wall. Will someone please help this new guy out?
I built a php webpage for an organization with multiple "locations". Each location is referenced in the body html in a <div> tag, initially set to visible (by default or other).
In php I'm reading an external text file, pulling out the tag id for the location I want to change from "visible" to "invisible". I have this code in a Javascript function:
<script languge="javascript" type="text/javascript">
function toggle(location) {
if (docment.getElementById(location).style.visibility=="hidden") {
document.getElementById(location).style.visibility = "visible";
} else {
document.getElementById(location).style.visibility = "hidden";
}
}
</script>
installed in the header section. the php variable is generated in the body from an array. Getting the array element value to a php variable is certainly no problem but all the variations (most using the echo statement) I've tried so far to get the php variable into the javascript variable "location" refuse to work (both with or without explicit declaration).
Most appreciative of any help I can get. Thanks, Michael
I built a php webpage for an organization with multiple "locations". Each location is referenced in the body html in a <div> tag, initially set to visible (by default or other).
In php I'm reading an external text file, pulling out the tag id for the location I want to change from "visible" to "invisible". I have this code in a Javascript function:
<script languge="javascript" type="text/javascript">
function toggle(location) {
if (docment.getElementById(location).style.visibility=="hidden") {
document.getElementById(location).style.visibility = "visible";
} else {
document.getElementById(location).style.visibility = "hidden";
}
}
</script>
installed in the header section. the php variable is generated in the body from an array. Getting the array element value to a php variable is certainly no problem but all the variations (most using the echo statement) I've tried so far to get the php variable into the javascript variable "location" refuse to work (both with or without explicit declaration).
Most appreciative of any help I can get. Thanks, Michael