Olga_Erm
20-02-2008, 19:54
Подскажите, пожалуйста, как сделать вертикальное меню, выпадающее не при наведении на него мышки, а при событии "click"?
Пишу так:
<script language="JavaScript" type="text/javascript">
<!--
if (document.getElementById) {
document.writeln('<style type="text/css"><!--')
document.writeln('.links {display:none; padding-left:14px}')
document.writeln('.link {text-decoration:none; color:blue}')
document.writeln('a:hover.link {text-decoration: underline; color: red}')
document.writeln('//--></style>') }
function openClose(theID) {
if (document.getElementById(theID).style.display == "block") {
document.getElementById(theID).style.display = "none";
document.getElementById("tick_"+theID).innerHTML = ""; }
else {
document.getElementById(theID).style.display = "block";
document.getElementById("tick_"+theID).innerHTML = ""; } }
function open(theID) {
document.getElementById(theID).style.display = "block";
document.getElementById("tick_"+theID).innerHTML = "-"; }
function Close(theID) {
document.getElementById(theID).style.display = "none";
document.getElementById("tick_"+theID).innerHTML = ""; }
// -->
</script>
<div onClick="openClose('a1');" style="cursor:hand; cursor:pointer"><span id="tick_a1"></span> <span onMouseOver="this.style.color='black';this.style.textDecoration='underline';" onMouseOut="this.style.color='black';this.style.textDecoration='none';"> <strong>·</strong>!!!!!</span></div>
<div id="a1" class="links">
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=131" > !!!!!</a><br>
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=132"> !!!!!</a><br>
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=133"> !!!!!</a><br>
но при обновлении странички меню сворачивается. Можно ли сделать так, чтобы меню оставалось в том же положении, что и до перехода на следующую страничку?
Пишу так:
<script language="JavaScript" type="text/javascript">
<!--
if (document.getElementById) {
document.writeln('<style type="text/css"><!--')
document.writeln('.links {display:none; padding-left:14px}')
document.writeln('.link {text-decoration:none; color:blue}')
document.writeln('a:hover.link {text-decoration: underline; color: red}')
document.writeln('//--></style>') }
function openClose(theID) {
if (document.getElementById(theID).style.display == "block") {
document.getElementById(theID).style.display = "none";
document.getElementById("tick_"+theID).innerHTML = ""; }
else {
document.getElementById(theID).style.display = "block";
document.getElementById("tick_"+theID).innerHTML = ""; } }
function open(theID) {
document.getElementById(theID).style.display = "block";
document.getElementById("tick_"+theID).innerHTML = "-"; }
function Close(theID) {
document.getElementById(theID).style.display = "none";
document.getElementById("tick_"+theID).innerHTML = ""; }
// -->
</script>
<div onClick="openClose('a1');" style="cursor:hand; cursor:pointer"><span id="tick_a1"></span> <span onMouseOver="this.style.color='black';this.style.textDecoration='underline';" onMouseOut="this.style.color='black';this.style.textDecoration='none';"> <strong>·</strong>!!!!!</span></div>
<div id="a1" class="links">
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=131" > !!!!!</a><br>
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=132"> !!!!!</a><br>
<strong>·</strong> <a href="modules.php?name=Content&pa=showpage&pid=133"> !!!!!</a><br>
но при обновлении странички меню сворачивается. Можно ли сделать так, чтобы меню оставалось в том же положении, что и до перехода на следующую страничку?