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

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



  #1  
ישן 23-05-2007, 16:28
צלמית המשתמש של tnadav1
  משתמש זכר tnadav1 tnadav1 אינו מחובר  
 
חבר מתאריך: 02.10.05
הודעות: 2,355
שלח הודעה דרך MSN אל tnadav1
בעיה נוספת במחלקה ליצירת חלון צף

אוקי.. דבר ראשון תודה רבה למקסים שמאוד עוזר לי ובזכותו אני מתקדם

קראתי במאמר הזה והפנמתי על this.. אבל עדיין כמו תמיד יש בעיות..
הנה המחלקה שלי כרגע:
קוד PHP:
 var 0;
var 
floatWindow = function(weightheightwindowTitle)
{
    
//reset all values
    
i++;
    
this.weight       =  weight;
    
this.height       =  height;
    
this.windowId     "window_"+i;
    
this.windowTopId  "window_top_"+i;
    
this.windowTitle  =  windowTitle;
    
this.startClient  =  new Array();
    
//Making a design of window
    
var windowContent "<div class='window_top' id='"+this.windowTopId+"'>"+windowTitle;
        
//coming soon...
            //<img src='images/top_left.gif' align='left'>
            //<img src='images/top_center.gif' class='topCenterImage'>
            //<<div class='top_buttons'>
                //<img class='minimizeButton' src='images/minimize.gif'>
                //<img class='closeButton' src='images/close.gif'>
        
                //<img src='images/top_right.gif'>
            //</div>
        
windowContent += "</div>";
        
windowContent += "<div class='windowMiddle'>";
            
windowContent += "<div class='windowContent'>";
                
//Starting window content...
                
windowContent += "Testing..Testing..123";
                
//End of window content...
            
windowContent += "</div>";
        
windowContent += "</div>";
        
windowContent += "<div class='window_bottom'>";
            
//<img class="resizeImage" src="images/bottom_right.gif">
        
windowContent += "</div>";
    
//Creating the element...
    
var window        document.createElement("div");
    
window.id         this.windowId;
    
window.className  'window';
    
window.innerHTML  windowContent;
    
document.body.appendChild(window);
    
this.windowObj    document.getElementById(this.windowId);
    
this.windowTopObj document.getElementById(this.windowTopId);
    
//end of creating element...
    //other functions...
    
function findX()
      {
        
obj this.windowObj;
        var 
curleft 0;
        if(
obj.offsetParent)
            while(
1
            {
                  
curleft += obj.offsetLeft;
                      if(!
obj.offsetParent)
                        break;
                  
obj obj.offsetParent;
            }
        else if(
obj.x)
            
curleft += obj.x;
        
        return 
curleft;
    }    
    function 
findY()
      {
        
obj this.windowObj;
        var 
curtop 0;
        if(
obj.offsetParent)
            while(
1)
            {
                  
curtop += obj.offsetTop;
                  if(!
obj.offsetParent)
                    break;
                  
obj obj.offsetParent;
            }
        else if(
obj.y)
            
curtop += obj.y;
        return 
curtop;
      }
    function 
updatePos(e)
    {
        if(
document.all)
            
event;
        
//-------------------------
        
this.windowObj.style.left  this.startClient[x] + e.clientX this.findX  'px';
        
this.windowObj.style.top   this.startClient[y] + e.clientY this.findY  'px';
    }
    function 
stopMove()
    {
        
this.onmousemove  null;
        
this.onmouseup    null;
    }
    function 
initMove(e)
    {
        if(
document.all)
            
event;
            
        
this.startClient['x']          = e.clientX;
        
this.startClient['y']          = e.clientY;
        
this.windowTopObj.onmousemove  = function () {this.updatePos()};
        
this.windowTopObj.onmouseup    this.stopMove;
    }
    
// Making evant
    
this.windowTopObj.onmousedown = function () {this.initMove()};


הבעיה היא בשורה הזאת:
קוד PHP:
 this.windowTopObj.onmousedown = function () {this.initMove()}; 

בגלל שבתוך ה- function, ה- this מיוחס לאלמנט ולא למחלקה, השאלה שלי היא, מה לשים במקום this כך שהאלמנט יהיה מיוחס למחלקה? אני לא יודע מה יהיה המופע של המחלקה...
_____________________________________


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

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

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

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

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



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

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

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

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