Jump to content

Recommended Posts

hi all , heres my code .....

 

<script type="text/javascript">
function showLayer(name)
{
name.style.display = "block";
}

function hideLayer(name)
{
name.style.display = "none";
}
</script>

Example click <span onclick="showLayer(thisone)" style="cursor:hand"><b>here</b></span><br>
<div id="thisone" style="position: top:100; left:10; absolute;display:none;">
Some text or other stuff
<br>
<a href="#null" style="cursor:hand" style="text-decoration:none;" onclick="hideLayer(thisone)">[ hide ]
</a>
</div>
<p>

Example click <span onclick="showLayer(sone)" style="cursor:hand"><b>here</b></span><br>
<div id="sone" style="position: absolute; display:none;">Some text or other stuff
<br><a href="#null" style="cursor:hand" style="text-decoration:none;" onclick="hideLayer(sone)">[ hide ]</a>
</div>
<p>

 

How can i make auto hide and open section by clicking another hidden ???

 

IE: i have this script above running 4 times on the page ,

menu1 - menu2 - menu3 - menu4

 

if i click menu1 it shows menu1 text , then if i click menu2 it will hide menu1 and show menu2.

 

at the moment the script will leave any open menus showing.

 

Thanks in advance for any help.

Link to comment
https://forums.phpfreaks.com/topic/259008-force-hide-a-hidden-text/
Share on other sites

We are a help form, but the code you posted is what I gave you in answer to a different problem you had. If you don't try to add the code you need to get things working the way you want; you are not asking for help, but for someone to do your work.

 

dude i pasted this code (that you gave me) as it was on the other page , i have edited it and my version is different just this way was fastest and showed the least details making solving the issue easier.

 

i didnt mean to offend you as i obviously did mate and for that i do apologies. untill 2weeks ago i didnt know nothing about java , i can do html,php,MySQL and untill now thats all ive used. now im toying with new stuff and just wanted a simple answer , sorry for not knowing what you guys know but trust me , i AM trying ;)

  • 2 weeks later...

First off, there's no Java in there. it's Javascript. Totally different.

 

Secondly, i don't think you are passing the object right from the onclick handler. I have not done "pure" javascript in awhile, but from what I recall, you can't simply pass the object by id as you have done in hideLayer(thisone).

 

I would suggest trying onclick="hideLayer('thisone')" and in your function, do a document.getElementById("thisone").style.display = "none";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.