![]() |
onclick assistance please
Hi everyone,
Just hoping to get some assistance. I've created an onclick function for a form to appear which works fine, there are 2 things which I need assistance for. 1. I want the form to remain hidden as default until clicked for it to appear 2. I would also like the form to disappear once it is clicked again I've kept the code as onmouseout="hide" just so it works (which is works fine) My code is as below <div onclick="show()" onmouseout="hide()" id="buyappear"><strong>Buy</strong></div> <div class="searchfunction"><input type="text" Value="Search" class="searchform" size="40" height="25" /></div> <!-- search function for buy --> <script>function show(){ document.getElementById("buyrevealed").style.display = "block"; } function hide(){ document.getElementById("buyrevealed").style.display = "none"; } </script> Any assistance would be appreciated. |
Quote:
Code:
<script type="text/javascript">“Expert: a man who makes three correct guesses consecutively.” - Dr. Laurence J. Peter (American "hierarchiologist", Educator and Writer, 1919-1990) |
Quote:
The word 'login' for example. onclick the login it will then display a form (THIS CURRENTLY WORKS FINE) Re-click the word "login" Form disappears. Currently I cannot onclick the word login for the form to disppear. I currently have it set on 'onmouseout' which works fine. I just want to be able to click on the word instead. I also want the form as default to appear hidden. |
Read Philip's code: You want a TOGGLE.
Here. The specific code for your actual situation: Code:
<div onclick="toggle()"><strong>Buy</strong></div> |
Quote:
|
Quote:
|
Of course.
How "generic" the toggle code is depends on your situation. Show the HTML and indicate what objects should toggle what targets. |
It would seem to me that Philip's code in post #2 can be used for multiple elements - just substitute the id of the element to be toggled for 'MyDiv' in the function call...
|
Hi everyone,
Below is my code for the toggle. I want the 'rentvealed', 'buyrevealed' and 'soldrevealed' to appear when they are onclicked, as they will all have different forms... Code:
<div onclick="toggle()"><strong>Rent</strong></div> |
Like I say, just pass the id of the element you want to toggle in the function call...
Code:
<body> |
Quote:
<div id="rentrevealed"><input type="text" value="search"</div> Any help would be apprecaited. These are not to appear at the same time... Click div1 - this will appear click div2 something else will appear etc.. thanks guys |
Help please?
Thank you. |
I've just used seperate toggles so I figures it out.
Whats the best way to incorporate fadein effect? Thanks |
Quote:
|
Hi guys,
I wanted to bring this thread back for some more assistance with the toggle function. Currently I have 4 seperate toggle functions - lets call them 1,2,3,4 The code of each toggle is as follows Code:
function toggle(1/2/3/4)I was hoping to get assistance to hide any other toggle unless it is clicked on so there won't be an issue when clicking on any of them Hope this makes sense. Thanks guys |
| All times are GMT +1. The time now is 08:54 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.