I want want to add a drop down menu to my php. The following is the hide and unhide code:
Like, just echo the javascript from PHP?
<?php
$javascript = 'function collapseAll() {
var menuDiv = document.getElementById("menu");
var divs = menuDiv.getElementsByTagName("div");
var div;
for ( i = 0; i < divs.length; i++ ) {
div = divs[i];
div.style.visibility = "hidden";
div.style.display = "none";
}
}';
?>
<html>
<head>
<title>A weird title</title>
<script language="javascript"><!-- // -->
<?php echo $javascript; ?>
<!-- --></script>
<body>
a useless body
</body>
</html>
Something like that... or were you asking how to actually convert that javascript code to php?