View Full Version : dot buttons - with drop down text

04-11-2011, 10:17 AM
I hope you can help with the following:

I want a page on my site that allows visitors to choose the best option for them. It will ask them a question and they will select 'yes' or 'no' and relevant information will appear to answer their question.

for example:

Q. Do you have cement?
A. 'Yes' button
Drop down text. 'please proceed to question 2'


Q. Do you have cement?
A. 'No' button
Drop down text. 'this is not suitable for you, please visit our sister website'

I hope this makes sense, I couldnt find an example to post.

Thank you for your help in advanced.

04-11-2011, 01:55 PM
In your header add this:
function sw(y,x){

In your CSS (or <style>...</style> in your header) add this:

#div1,#div2 {visibility:hidden;}

In the body add this:
<button onclick=sw('on','div1')>Show</button>
<div id=div1>
Text of div1
<button onclick=sw('off','div1')>Hide</button>

<button onclick=sw('on','div2')>Show</button>
<div id=div2>
Text of div2
<button onclick=sw('off','div2')>Hide</button>

Name the divs as you will, put them where you want, and add your text as placed above. This will open & shut the text boxes when the respective button is clicked.

04-11-2011, 03:31 PM
Thank you so much, Its just what i wanted to achieve.... Perfect.

04-11-2011, 03:34 PM
sorry... just one other thing, Is that code javascript?

04-11-2011, 03:38 PM
you're welcome, glad I could help, and yes, JS...