לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 17-09-2007, 14:21
צלמית המשתמש של tnadav1
  משתמש זכר tnadav1 tnadav1 אינו מחובר  
 
חבר מתאריך: 02.10.05
הודעות: 2,355
שלח הודעה דרך MSN אל tnadav1
בעיה ב- SetInterval כאשר קוראים לה מתוך המחלקה

עד עכשיו השתמשתי בפיתרון של fat-fish בשביל לעשות טקסט נגלל, אבל המחשב שלי התחיל לעשות צרות ונעלמה לי כמות יפה, כולל ספרייה לא קטנה של כל מיני דברים שעשיתי..

בגלל שלא מצאתי את הפיתרון שלו באינטרנט החלטתי לעשות זריז פיתרון דומה, זה מה שעשיתי עד עכשיו:
קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Scroller</title> <style type="text/css"> .sframe { overflow:hidden; position:relative; } .scroller { position:absolute; top: 0px; } </style> <script language="JavaScript" type="text/javascript"> <!-- var d = document; var divScroller = function(id, speed) { this.frame = d.getElementById(id); this.scrolledDiv = this.frame.firstChild; this.height = this.frame.style.height; //-------------------------------------------- this.moveDiv = function() { if(this.scrolledDiv.style.top >= this.height) this.scrolledDiv.style.top = (-this.scrolledDiv.offserHeight) + "px"; this.scrolledDiv.style.top = (parseInt(this.scrolledDiv.style.top) + 1) +"px"; } this.handler = window.setInterval("this.moveDiv()", 500); } //--> </script> </head> <body> <div class="sframe" style="width: 200px; height: 200px;" id="scroll"> <div class="scroller"> Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text Text text and a lot of text </div> </div> <script type="text/javascript"> <!-- var marquue = new divScroller("scroll", 500); //--> </script> </body> </html>

בכל מקרה הדפדפן מוציא שגיאה:
קוד:
this.moveDiv is not a function

בשורה:
קוד:
this.handler = window.setInterval("this.moveDiv()", 500);
_____________________________________


תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #7  
ישן 19-09-2007, 14:47
צלמית המשתמש של tnadav1
  משתמש זכר tnadav1 tnadav1 אינו מחובר  
 
חבר מתאריך: 02.10.05
הודעות: 2,355
שלח הודעה דרך MSN אל tnadav1
בתגובה להודעה מספר 6 שנכתבה על ידי Silver Strike שמתחילה ב "1. תסביר לי את:..."

1) שים לב, כמה שורות למעלה:
קוד:
this.frame = d.getElementById(id);

2) פעם הבאה אני יעשה את זה... בכל מקרה פתרתי את הבעיה כך:
קוד:
var d = document; var divScroller = function(id, speed, sDir) { this.frame = d.getElementById(id); this.scrolledDiv = this.frame.firstChild; this.height = this.frame.style.height; this.sDir = sDir; //-------------------------------------------- if(this.sDir == "u") this.scrolledDiv.style.top = (this.frame.offsetHeight) + "px"; else this.scrolledDiv.style.top = (0 - this.scrolledDiv.offsetHeight) + "px"; this.moveDiv = function() { var top = (obj.scrolledDiv.style.top)?parseInt(obj.scrolledD iv.style.top):0; if(obj.sDir == "u") { obj.scrolledDiv.style.top = (--top) +"px"; if(top < 0 - obj.scrolledDiv.offsetHeight) obj.scrolledDiv.style.top = (obj.frame.offsetHeight) + "px"; } else { obj.scrolledDiv.style.top = (++top) +"px"; if(top > parseInt(obj.frame.style.height)) obj.scrolledDiv.style.top = (0 - obj.scrolledDiv.offsetHeight) + "px"; } } var obj=this; this.handler = window.setInterval(this.moveDiv, speed); }
_____________________________________


תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 14:16

הדף נוצר ב 0.04 שניות עם 12 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2025 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר