Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [js] jak zrobic link
Forum PHP.pl > Forum > Przedszkole
andixxx
nie wiem czy to jest dobre miejsce na to, ale naprawde potrzebuje pomocy sad.gif

mam taki kod (index.php)
  1. ...
  2.  
  3. <script language="JavaScript" type="text/javascript">
  4. function lib_bwcheck(){ //Browsercheck (needed)
  5. this.ver=navigator.appVersion
  6. this.agent=navigator.userAgent
  7. this.dom=document.getElementById?1:0
  8. this.opera5=this.agent.indexOf("Opera 5")>-1
  9. this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
  10. this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
  11. this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  12. this.ie=this.ie4||this.ie5||this.ie6
  13. this.mac=this.agent.indexOf("Mac")>-1
  14. this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
  15. this.ns4=(document.layers && !this.dom)?1:0;
  16. this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
  17. return this
  18. }
  19. var bw=new lib_bwcheck()
  20. timSpeed = 20
  21. contHeight = 330
  22. function makeScrollObj(obj,nest){
  23. nest=(!nest) ? "":'document.'+nest+'.'
  24. this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  25. this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
  26. this.height=bw.ns4?this.css.document.height:this.el.offsetHeight
  27. this.top=b_gettop
  28. return this
  29. }
  30. var px = bw.ns4||window.opera?"":"px";
  31. function b_gettop(){
  32. var gleft=(bw.ns4 || bw.ns6)?parseInt(this.css.top):eval(this.css.pixelTop);
  33. return gleft;
  34. }
  35. var scrollTim = 1;
  36. var active = 0;
  37. function scroll(speed){
  38. clearTimeout(scrollTim)
  39. way = speed>0?1:0
  40. if ((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way)){
  41. oScroll[active].css.top = (oScroll[active].top()+speed)+px
  42. scrollTim = setTimeout("scroll("+speed+")",timSpeed)
  43. }
  44. }
  45. function noScroll(){
  46. clearTimeout(scrollTim)
  47. }
  48. function changeActive(num){
  49. oScroll[active].css.visibility = "hidden"
  50. active = num
  51. oScroll[active].css.top = 0+px
  52. oScroll[active].css.visibility = "visible"
  53. }
  54. function scrollInit(){
  55. oScroll = new Array()
  56.  
  57. oScroll[0] = new makeScrollObj('divScroll1','divCont')
  58. oScroll[1] = new makeScrollObj('divScroll2','divCont')
  59. oScroll[2] = new makeScrollObj('divScroll3','divCont')
  60. oScroll[3] = new makeScrollObj('divScroll4','divCont')
  61. oScroll[4] = new makeScrollObj('divScroll5','divCont')
  62. oScroll[5] = new makeScrollObj('divScroll6','divCont')
  63.  
  64. oScroll[0].css.left = 0+px
  65. oScroll[0].css.top = 0+px
  66. oScroll[0].css.visibility = "visible"
  67. oControl = new makeScrollObj('divControl')
  68. oControl.css.visibility = "visible"
  69. }
  70. onload = scrollInit;
  71.  
  72. ...
  73.  
  74. <a href="#"><img src="images/index_01.jpg" border="0" onmouseover="this.src='images/index_01a.jpg'" onmouseout="this.src='images/index_01.jpg'" title="Start" border="0" onclick="changeActive(0); return false"></a>
  75. <a href="#"><img src="images/index_02.jpg" border="0" onmouseover="this.src='images/index_02a.jpg'" onmouseout="this.src='images/index_02.jpg'" title="Biografia" border="0" onclick="changeActive(1); return false"></a>
  76. <a href="#"><img src="images/index_04.jpg" border="0" onmouseover="this.src='images/index_04a.jpg'" onmouseout="this.src='images/index_04.jpg'" title="Teksty" border="0" onclick="changeActive(2); return false"></a>
  77.  
  78. ...
  79.  
  80. <div id="divCont">
  81. <div id="divScroll1" class="clScroll"><? include ("i_start.php"); ?></div>
  82. <div id="divScroll2" class="clScroll"><?php include "i_biografia.php" ?></div>
  83. <div id="divScroll3" class="clScroll"><?php include "i_teksty.php" ?></div>
  84. <div id="divScroll4" class="clScroll"><?php include "i_pobieralnia.php" ?></div>
  85. <div id="divScroll5" class="clScroll"><?php include "i_fotorelacje.php" ?></div>
  86. <div id="divScroll6" class="clScroll"><?php include "i_kontakt.php" ?></div>
  87. </div>


chodzi o to, ze w dokumencie wszystko dziala, ale jak z zewnatrz (tzn po wpisaniu adresu do przegladarki) wyswietlic od razu blok (div) "biografie"? (div id="divScroll2") ..kombinuje kombinuje i nie moge sobie poradzic sad.gif
b_chmura
jeśli chodzi Ci aby jedna z "podstron" była od razu aktywna wystarczy w jej stylach dać visibility = "visible"
jeśli potrzebujesz odczytać z adresu strony jaka podstrona ma być aktualnie wyświetlona poczytaj o kotwicy (jeśli chcesz uzyskać ten efekt przez js)
andixxx
prubowalem i nie dziala .. wiec, jak zrobic za pomoca kotwicy np tak aby po wpisaniu adresu w przegladarce od razu przekierowalo na ten (wewnetrzny) link?
  1. <a href="#"><img src="images/index_02.jpg" border="0" onmouseover="this.src='images/index_02a.jpg'" onmouseout="this.src='images/index_02.jpg'" title="Biografia" border="0" onclick="changeActive(1); return false"></a>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.