Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Dlaczego razem nie chcą działać?
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
piwib
Witam. Mam dwa skrypty który działają tylko jak sa same. Jak sa obydwa na stronie to działa tylko pierwszy wywołany. Dlaczego ? podaje treść skryptów

  1. <script language="JavaScript1.2">
  2.  
  3. /*
  4. Cross browser Marquee script- Š Dynamic Drive (www.dynamicdrive.com)
  5. For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
  6. Credit MUST stay intact
  7. */
  8.  
  9. //Specify the marquee's width (in pixels)
  10. var marqueewidth="400px"
  11. //Specify the marquee's height
  12. var marqueeheight="16px"
  13. //Specify the marquee's marquee speed (larger is faster 1-10)
  14. var marqueespeed=2
  15. //configure background color:
  16. var marqueebgcolor="#DEFDD9"
  17. //Pause marquee onMousever (0=no. 1=yes)?
  18. var pauseit=1
  19.  
  20. //Specify the marquee's content (don't delete <nobr> tag)
  21. //Keep all content on ONE line, and backslash any single quotations (ie: that's great):
  22.  
  23. var marqueecontent='<nobr><span class="bluetext">Artykuły:</span><span class="small_text"> <a href="index.php?id=art&topic=93">iPod nano</a> :: <a href="index.php?id=art&topic=92">Actions/Akcje w Photoshop</a> :: <a href="index.php?id=art&topic=91">Śnieg - xmas cz.2</a> :: <a href="index.php?id=art&topic=90">Lampki choinkowe - xmas cz.1</a> :: <a href="index.php?id=art&topic=89">Droga mleczna</a> :: <a href="index.php?id=art&topic=88">Macki</a> :: <a href="index.php?id=art&topic=87">Hue/Saturation</a> :: <a href="index.php?id=art&topic=85">Taśma klejąca</a> :: <a href="index.php?id=art&topic=84">Przycisk - mac style</a> :: <a href="index.php?id=art&topic=82">Znaczek</a> :: <a href="index.php?id=art&topic=81">Zniszczony text</a> :: <a href="index.php?id=art&topic=80">Kanał RSS ze skryptu PsNews</a> :: <a href="index.php?id=art&topic=79">Redukowanie członów hosta</a> :: <a href="index.php?id=art&topic=78">Lustrzane odbicie</a> :: <a href="index.php?id=art&topic=77">Metal</a> :: </span><span class="bluetext">Download:</span><span class="small_text"> <a href="index.php?id=download&file=139">Opera 7.54u2 PL</a> :: <a href="index.php?id=download&file=138"></a> :: <a href="index.php?id=download&file=137">Zegarek</a> :: <a href="index.php?id=download&file=135">base 02 - czcionka</a> :: <a href="index.php?id=download&file=134">FeedDemon - Trial</a> :: <a href="index.php?id=download&file=133">php 4.3.9RC3 - tar.gz</a> :: <a href="index.php?id=download&file=132">php 4.3.9RC3 - .tar.bz2</a> :: <a href="index.php?id=download&file=131">php 4.3.9RC3 - Windows</a> :: <a href="index.php?id=download&file=130">15 Numer magazynu @t</a> :: <a href="index.php?id=download&file=129">Krasnal Serv 2.7</a> :: <a href="index.php?id=download&file=126">Mozilla 1.6 Beta PL</a> :: <a href="index.php?id=download&file=125">Netscape Navigator 7</a> :: <a href="index.php?id=download&file=123">Cliff's Really Nifty Guestbook</a> :: <a href="index.php?id=download&file=122">AdControl</a> :: <a href="index.php?id=download&file=121">newsPHP</a> :: <a href="index.php?id=download&file=120">Sonic</a> :: <a href="index.php?id=download&file=119">Orange abstract</a> :: <a href="index.php?id=download&file=117">Zestaw- Głośniki</a> :: <a href="index.php?id=download&file=116">Portal muzyczny</a> :: <a href="index.php?id=download&file=115">Manga layout</a> :: <a href="index.php?id=download&file=114">Kurs HTML Off-Line</a> :: <a href="index.php?id=download&file=113">Planeta Flash</a> :: <a href="index.php?id=download&file=112">Kosmos Flash</a> :: <a href="index.php?id=download&file=111">Kursor Flash</a> :: <a href="index.php?id=download&file=110">Tabelki Flash</a> :: </span></nobr>'
  24.  
  25.  
  26. ////NO NEED TO EDIT BELOW THIS LINE////////////
  27. marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
  28. var copyspeed=marqueespeed
  29. var pausespeed=(pauseit==0)? copyspeed: 0
  30. var iedom=document.all||document.getElementById
  31. if (iedom)
  32. document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
  33. var actualwidth=''
  34. var cross_marquee, ns_marquee
  35.  
  36. function populate(){
  37. if (iedom){
  38. cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  39. cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
  40. cross_marquee.innerHTML=marqueecontent
  41. actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
  42. }
  43. else if (document.layers){
  44. ns_marquee=document.ns_marquee.document.ns_marquee2
  45. ns_marquee.left=parseInt(marqueewidth)+8
  46. ns_marquee.document.write(marqueecontent)
  47. ns_marquee.document.close()
  48. actualwidth=ns_marquee.document.width
  49. }
  50. lefttime=setInterval("scrollmarquee()",20)
  51. }
  52. window.onload=populate
  53.  
  54. function scrollmarquee(){
  55. if (iedom){
  56. if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  57. cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
  58. else
  59. cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
  60.  
  61. }
  62. else if (document.layers){
  63. if (ns_marquee.left>(actualwidth*(-1)+8))
  64. ns_marquee.left-=copyspeed
  65. else
  66. ns_marquee.left=parseInt(marqueewidth)+8
  67. }
  68. }
  69.  
  70. if (iedom||document.layers){
  71. with (document){
  72. document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  73. if (iedom){
  74. write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  75. write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  76. write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
  77. write('</div></div>')
  78. }
  79. else if (document.layers){
  80. write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">')
  81. write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  82. write('</ilayer>')
  83. }
  84. document.write('</td></table>')
  85. }
  86. }


i drugi:

  1. <script TYPE="text/javascript">
  2. <!--
  3.  
  4. function newImage(arg) {
  5. if (document.images) {
  6. rslt = new Image();
  7. rslt.src = arg;
  8. return rslt;
  9. }
  10. }
  11.  
  12. function changeImages() {
  13. if (document.images && (preloadFlag == true)) {
  14. for (var i=0; i<changeImages.arguments.length; i+=2) {
  15. document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  16. }
  17. }
  18. }
  19.  
  20. var preloadFlag = false;
  21. function preloadImages() {
  22. if (document.images) {
  23. projekt_caly_gif_01_projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_01-projekt.gif");
  24. projekt_caly_gif_02_projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_02-projekt.gif");
  25. projekt_caly_gif_02_projekt_caly_gif_04_over = newImage("images/projekt_caly-gif_02-proj-05.gif");
  26. projekt_caly_gif_02_projekt_caly_gif_05_over = newImage("images/projekt_caly-gif_02-proj-06.gif");
  27. projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_03-over.gif");
  28. projekt_caly_gif_04_projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_04-projekt.gif");
  29. projekt_caly_gif_05_projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_05-projekt.gif");
  30. projekt_caly_gif_05_projekt_caly_gif_04_over = newImage("images/projekt_caly-gif_05-proj-13.gif");
  31. projekt_caly_gif_06_projekt_caly_gif_03_over = newImage("images/projekt_caly-gif_06-projekt.gif");
  32. projekt_caly_gif_06_projekt_caly_gif_04_over = newImage("images/projekt_caly-gif_06-proj-16.gif");
  33. projekt_caly_gif_06_projekt_caly_gif_05_over = newImage("images/projekt_caly-gif_06-proj-17.gif");
  34. preloadFlag = true;
  35. }
  36. }
  37.  
  38. // -->
  39. </SCRIPT>
siemakuba
a jak je wywołujesz?
nie przypadkiem tak, że ten od marquee poprostu wstawiasz w HEAD i działa, a ten od preloadImages wywołujesz w <body onload="">?

pozdr.
piwib
Oby dwa umieszczam w body. Jakbym nie kombinował to skrypt preloadImages nie chce działać z marquee ale sam marquee chodzi

Jakie kolwiek bym nie dodawał skrypty ten za opcługe gifa nie chce działać... Gdzie mam błąd?

Dodam jeszcze że skrypt odpowiedzialny za gify jest wygenerowany przez ImageReady więc może ma to jakiś związek...
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.