PDA

View Full Version : Need help with a code!


stephly350
09-18-2006, 08:59 AM
I needed help with a code and someone gave me this example...

http://degs.co.uk/test/hct/show_hide_text3.htm

It was exactly what I needed, but when I tried to use it in firefox, it wouldn't work.
He gave me another example...

http://degs.co.uk/test/hct/show_hide_text5_mozilla.htm

and it still didn't work in firefox.

Anyone have another suggestion? :ouch:

tmmoose
09-18-2006, 04:06 PM
FLASH.....Sample (http://www.how-dee.com/evrsoft/evrmenu.html)

stephly350
09-18-2006, 09:38 PM
... that page is blank.

stephly350
09-19-2006, 09:20 AM
.. nevermind it's not blank.. the computer I was using doesn't support flash. It looks cool but I need a text version like the examples I posted. Thanks though

Tarmithius
09-19-2006, 02:15 PM
CSS menus are the way to go, the problem is not all browsers support all the functions across the board.

http://css.maxdesign.com.au/listamatic/
http://www.cssplay.co.uk/menus/index.html

stephly350
09-20-2006, 10:23 AM
Thanks but that's not really what I was looking for... I don't need just a list. This is what I'm trying to do...

http://missfoshee.bravehost.com/test.txt

That is what I want, BUT when using firefox, the links don't drop down. I need a code that does exactly what I have there, but that will also work in firefox.

tmmoose
09-20-2006, 11:14 AM
Done in Flash......Sample (http://www.how-dee.com/evrsoft/evrmenu.html)

tmmoose
09-20-2006, 06:08 PM
This may work....portfolio (http://www.how-dee.com/evrsoft/portfolio.html)

Tarmithius
09-20-2006, 06:14 PM
Thanks but that's not really what I was looking for... I don't need just a list. This is what I'm trying to do...

http://missfoshee.bravehost.com/test.txt

That is what I want, BUT when using firefox, the links don't drop down. I need a code that does exactly what I have there, but that will also work in firefox.

And what would show if one had javascripts turned off? Your simplist method would be css. Also at the end of that script is styled using css.

For css drop down check this out: Drop Down Menus (http://www.google.com/search?hl=en&hs=wys&safe=off&client=firefox-a&rls=org.mozilla:en-US:official&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=css+drop+down&spell=1)

stephly350
09-22-2006, 09:52 AM
Okay I found one I like... thanks everyone for your help!

Tarmithius
09-22-2006, 05:41 PM
well let us know what you found and why it worked out for you.

epement
10-10-2006, 03:48 PM
Thanks but that's not really what I was looking for... I don't need just a list. This is what I'm trying to do...

http://missfoshee.bravehost.com/test.txt

That is what I want, BUT when using firefox, the links don't drop down. I need a code that does exactly what I have there, but that will also work in firefox.

Begin with the fact that there are two different HEAD and DOCTYPE declarations in the same file. First, fix that basic problem. Try visiting http://validator.w3.org to submit your files before you fix things.

Anyway, I got it to work in Firefox and Opera. Some basics: in the JavaScript language, "show(foo)", that word "foo" is taken as a variable. In the anchor tag, you have onclick="show(text1)", which should have been onclick="show('text1')" -- note those single quotes -- because you want to work on a literal ID string that says "text1". Hence, the quotes are necessary.

In the <script> tag, you should declare the type="text/javascript", and the show(text) function did not work because it forgot what text is supposed to stand for. In the script, text is a variable representing a unique string for the ID. Therefore, you cannot write something like:

text.style.display = "none"

Instead, you have to write

document.getElementById(text).style.display = "none"

Here is a cleaned up version of the code.


<script type="text/javascript" language="javascript">
function hideAll(){
if (document.all) {
for (x in document.all.tags('div')) {
if (!x.indexOf('text')){
document.getElementById(x).style.cssText = 'display: none';
}
}
}
}

function show(text){
if(document.getElementById(text).style.display == "none"){
hideAll()
document.getElementById(text).style.display = "";
}
else {
document.getElementById(text).style.display = "none";
}
}
</script>


And then below that, you can put in your hyperlink, properly formatted:

<a href="javascript:void()" onclick="show('text1')">My Portfolio</a>


That was what was wrong, and should probably work for you.