943,789 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 955
  • PHP RSS
Jan 11th, 2009
0

php pop-up link pls help

Expand Post »
hi.!!I have been developing an online enrolment system for a client in php...ive encountered a problem during the middle situation.The client added a situation that when the student click on the first year link, the subject of that year will just pop-up under the link.example:

first year
- Filipino
- Math
- Science

When the user click first year, the filipino,math, and science will appear, and will dissapear when they click another link.

Please help i dont know how to do this.!
Last edited by blocker; Jan 11th, 2009 at 12:11 am. Reason: wrong title
Similar Threads
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
blocker is offline Offline
231 posts
since Jan 2009
Jan 11th, 2009
0

Re: php pop-up link pls help

As PHP is a server side language, PHP can't be used to modify the page once it has been sent to the browser. You need a client side language (that is executed by the viewers browser) such as Javascript to do what you are explaining. I haven't done much with javasript so I can't help you any further.
Reputation Points: 20
Solved Threads: 13
Junior Poster in Training
humbug is offline Offline
93 posts
since Oct 2005
Jan 11th, 2009
0

Re: php pop-up link pls help

html Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <style>
  4. .year { width:25%; margin:3%; padding:3%; float:left; }
  5. </style>
  6. <script language="javascript" type="text/javascript">
  7. <!--
  8. (document.getElementById) ? dom = true : dom = false;
  9. function hideIt(layer) {
  10.  if (dom) {document.getElementById(layer).style.visibility='hidden';} //ie
  11.  if (document.layers) {document.layers[layer].visibility='hide';} } //mozilla
  12. function showIt(layer) {
  13.  if (dom) {document.getElementById(layer).style.visibility='visible';} //ie
  14.  if (document.layers) {document.layers[layer].visibility='show';} } //mozilla
  15. onResize="window.location.href = window.location.href"
  16. //--></script>
  17. </head>
  18. <body>
  19. <noscript> This form requires Javascript to process</noscript>
  20. <div class='year'>
  21. <a href='#' onfocus="showIt('firstyear');" onclick="showIt('firstyear');" onblur="hideIt('firstyear');" taborder=1>First Year</a> <!-- onfocus onclick allows for keyboard tab as well as mouseclick-->
  22. <div id='firstyear' style='visibility:hidden'> <!-- initially invisible -->
  23. <input type='checkbox' value='filipino'>filipino<br>
  24. <input type='checkbox' value='math'>math<br>
  25. <input type='checkbox' value='sci'>science<br>
  26. </div></div>
  27. <div class='year'>
  28. <a href='#' onfocus="showIt('secondyear');" onclick="showIt('secondyear');" onblur="hideIt('secondyear');" taborder=2>second Year</a>
  29. <div id='secondyear' style='visibility:hidden'>
  30. <input type='checkbox' value='filipino'>2filipino<br>
  31. <input type='checkbox' value='math'>2math<br>
  32. <input type='checkbox' value='sci'>2science<br>
  33. </div></div>
  34. <div class='year'>
  35. <a href='#' onfocus="showIt('thirdyear');" onclick="showIt('thirdyear');" onblur="hideIt('thirdyear');" taborder=3>third Year</a>
  36. <div id='thirdyear' style='visibility:hidden'>
  37. <input type='checkbox' value='filipino'>3filipino<br>
  38. <input type='checkbox' value='math'>3math<br>
  39. <input type='checkbox' value='sci'>3science<br>
  40. </div></div>
  41. </body</html>
the javacript will hide or show any number of div span p textarea
Its been a long time since I coded anything new in javascript, if the script does not run, change the id='firstyear' to name='firstyear' edit** for tabulated data as
first year .. second year .. third year
Last edited by almostbob; Jan 11th, 2009 at 5:38 pm.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Jan 11th, 2009
0

Re: php pop-up link pls help

i messed up
as above attempting to select a checkbox will hide them again, should be::
<a href='#' onfocus="showIt('firstyear');hideIt('secondyear');hideIt('thirdyear');" onclick="showIt('firstyear');hideIt('secondyear');hideIt('thirdyear');" tabindex=1>First Year</a>
Last edited by almostbob; Jan 11th, 2009 at 6:04 pm.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Jan 15th, 2009
0

Re: php pop-up link pls help

thank you very much its working now..hope to see you again.!1

God bless.!
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
blocker is offline Offline
231 posts
since Jan 2009
Jan 15th, 2009
0

Re: php pop-up link pls help

Click to Expand / Collapse  Quote originally posted by humbug ...
As PHP is a server side language, PHP can't be used to modify the page once it has been sent to the browser. You need a client side language (that is executed by the viewers browser) such as Javascript to do what you are explaining. I haven't done much with javasript so I can't help you any further.

Thank you for your advise>!!i will try to search and code this maybe tommorow in javascript.!
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
blocker is offline Offline
231 posts
since Jan 2009
Jan 15th, 2009
0

Re: php pop-up link pls help

Click to Expand / Collapse  Quote originally posted by almostbob ...
html Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <style>
  4. .year { width:25%; margin:3%; padding:3%; float:left; }
  5. </style>
  6. <script language="javascript" type="text/javascript">
  7. <!--
  8. (document.getElementById) ? dom = true : dom = false;
  9. function hideIt(layer) {
  10.  if (dom) {document.getElementById(layer).style.visibility='hidden';} //ie
  11.  if (document.layers) {document.layers[layer].visibility='hide';} } //mozilla
  12. function showIt(layer) {
  13.  if (dom) {document.getElementById(layer).style.visibility='visible';} //ie
  14.  if (document.layers) {document.layers[layer].visibility='show';} } //mozilla
  15. onResize="window.location.href = window.location.href"
  16. //--></script>
  17. </head>
  18. <body>
  19. <noscript> This form requires Javascript to process</noscript>
  20. <div class='year'>
  21. <a href='#' onfocus="showIt('firstyear');" onclick="showIt('firstyear');" onblur="hideIt('firstyear');" taborder=1>First Year</a> <!-- onfocus onclick allows for keyboard tab as well as mouseclick-->
  22. <div id='firstyear' style='visibility:hidden'> <!-- initially invisible -->
  23. <input type='checkbox' value='filipino'>filipino<br>
  24. <input type='checkbox' value='math'>math<br>
  25. <input type='checkbox' value='sci'>science<br>
  26. </div></div>
  27. <div class='year'>
  28. <a href='#' onfocus="showIt('secondyear');" onclick="showIt('secondyear');" onblur="hideIt('secondyear');" taborder=2>second Year</a>
  29. <div id='secondyear' style='visibility:hidden'>
  30. <input type='checkbox' value='filipino'>2filipino<br>
  31. <input type='checkbox' value='math'>2math<br>
  32. <input type='checkbox' value='sci'>2science<br>
  33. </div></div>
  34. <div class='year'>
  35. <a href='#' onfocus="showIt('thirdyear');" onclick="showIt('thirdyear');" onblur="hideIt('thirdyear');" taborder=3>third Year</a>
  36. <div id='thirdyear' style='visibility:hidden'>
  37. <input type='checkbox' value='filipino'>3filipino<br>
  38. <input type='checkbox' value='math'>3math<br>
  39. <input type='checkbox' value='sci'>3science<br>
  40. </div></div>
  41. </body</html>
the javacript will hide or show any number of div span p textarea
Its been a long time since I coded anything new in javascript, if the script does not run, change the id='firstyear' to name='firstyear' edit** for tabulated data as
first year .. second year .. third year
Thank you so much.its working now..hope to see you again.!

God bless.!
Reputation Points: 7
Solved Threads: 1
Posting Whiz in Training
blocker is offline Offline
231 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: the value of foreach loop keeps increasing
Next Thread in PHP Forum Timeline: How to add amount of items in shopping cart? Need urgent help!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC