Web Hosting Talk







View Full Version : simple hyperlink help


hoachen
08-11-2005, 01:48 PM
hi, everyone.
I am stuck again and you guys help.
I am messing around the link using dreamweaver and could not figure it what I want for the link. The bad thing I don't know how it call if not I can seach on the internet.
Here is what I want for the hyperlink

<a href="http://www.cscourse.com"> CS Course </a>

when I click on "Course" it will display multiple courses list below it.

AFTER CLINK ON CS COURSE
Courses
cs 123
cs abc
cs 345
cd 234

WHEN I CLICK ON CS COURSE AGAIN. THOSE COURSE WILL DISAPPEAR. BACK TO NORMAL "CS COURSE"

Anyone get what i am talking about? I really need your kind help!

cheer
hoachen

angst7
08-11-2005, 02:58 PM
If I understand you correctly, you're looking to add a javascript toggle function. Check this thread (http://www.webhostingtalk.com/showthread.php?s=&threadid=357735) for an example of how to do this.

hoachen
08-11-2005, 03:04 PM
it kinds of similar with what I want but this one need to use plus and minus to display the text. Anywhere do not need the plus minus button ? JUst click on the link then it will show. Anyway, I will try it and modify it see I can get aroud with it. Thank you very much. Have a nice day.

cheer
hoachen

Originally posted by angst7
If I understand you correctly, you're looking to add a javascript toggle function. Check this thread (http://www.webhostingtalk.com/showthread.php?s=&threadid=357735) for an example of how to do this.

fozzy
08-11-2005, 04:29 PM
Would something like this work?


<?php

if ($_REQUEST['courses'] == TRUE){
echo "<a href=\"http://www.cscourse.com?courses=false\"> CS Course </a><br>";
echo "cs 123<br>cs abc<br>cs 345<br>cd 234<br>";
}
else {
echo "<a href=\"http://www.cscourse.com?courses=true\"> CS Course </a><br>";
}


?>


This would reload the page every time where as javascript would not.

ethereality
08-11-2005, 04:55 PM
why use PHP if you can use simple javascript?

hoachen
08-11-2005, 05:01 PM
i didn't say i will use only php, any language would work i will implement it.


Originally posted by ethereality
why use PHP if you can use simple javascript?

hoachen
08-11-2005, 06:40 PM
thanks everyone. I found the solution on the net. Here is the <span class="style5">Title: Web Developer - Internship<br></span> <br>


<script>

function WM_toggle(id){

if (document.all){

if(document.all[id].style.display == 'none'){

document.all[id].style.display = '';

} else {

document.all[id].style.display = 'none';

}

return false;

} else if (document.getElementById){

if(document.getElementById(id).style.display == 'none'){

document.getElementById(id).style.display = 'block';

} else {

document.getElementById(id).style.display = 'none';

}

return false;

}

}

</script>
<p class="header"><a href="#" onclick="WM_toggle('multimedia'); return false">MBS Textbook Exchange, Inc</a></p>

<p id="multimedia" class="menu" style="display: none">

Flammable
08-11-2005, 06:43 PM
Nice to see people posting their solution.

hoachen
08-11-2005, 06:44 PM
Ya, I agreed. That way we learn more and no more question to ask next time when you need it! :D

Originally posted by Flammable
Nice to see people posting their solution.