Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE,FIREFOX,NETSCAPE not executing code 1

Status
Not open for further replies.

sirlojik

Programmer
Mar 29, 2005
178
UG
Hi all,
I have had it, my script is not working at all when on my server. i am going to post links to my js files and a link to the index file. please advise. it keeps giving me an error saying object expected or function dnt exist. the function exists etc. The script executes on my pc offline.
also, the skin doesn't wrap well in netscape browsers, i have to force a refresh before it looks good.

here is a link to the file on the server

here are links to js files in order of their arrangment in the index file.

macros API -->

Event Handling API -->

domObjects API -->

canvas API -->

here is the index file.
Code:
<HTML>  
<HEAD>
<script src='macros.js' type='text/javascript'> </script>
<script src='events.js' type='text/javascript'> </script>
<script src='domobject.js' type='text/javascript'> </script>
<script src='canvas.js' type='text/javascript'> </script>
<BODY background="desktop/bk.jpg">
<script lang="javascript2.0">
//------------------------------
//Window Borders Styles
//------------------------------
var winFlatStyle = 0;
var winDefStyle  = 1;
var twin_borderheight = 18;                         

//------------------------------
var winSkins = new Object();
//------------------------------
    winSkins['topleftcorner']     = 'imgs/topleft_c.jpg';
    winSkins['topborder']         = 'imgs/top.jpg';
    winSkins['toprightcorner']    = 'imgs/topright_c.jpg';
    winSkins['titleleftborder']   = 'imgs/twin_left.jpg';
    winSkins['titlerightborder']  = 'imgs/twin_right.jpg';
    winSkins['titlerightcorner']  = 'imgs/twin_right_c.jpg';
    winSkins['titleleftcorner']   = 'imgs/twin_left_c.jpg';
    winSkins['titlebottom']       = 'imgs/twin_bottom.jpg';
    winSkins['leftborder']        = 'imgs/left.jpg';
    winSkins['rightborder']       = 'imgs/right.jpg';
    winSkins['bottomborder']      = 'imgs/bottom.jpg';
    winSkins['bottomleftcorner']  = 'imgs/bottomleft_c.jpg';
    winSkins['bottomrightcorner'] = 'imgs/bottomright_c.jpg';

//------------------------------
skinParse = function (sObj,domain)
//------------------------------
  {
   var dimObj = new Object();
   var skinObj= new Object();
   for (n in sObj)
    {
    nam = domain + sObj[n];
    skinObj[n] = gf_PreloadIMG(nam); 
    dimObj[n]  = gf_GetImgSize(nam);
    } 
    return [dimObj,skinObj]
  }
  
//------------------------------
w_DrawBorder = function (t,type,sObj)
//t   : Canvas to Draw on
//type: Window Style. Default/Flat
//skinObj: skinObject
//domain : domain
//------------------------------
  {
  var cx,cy,dimObj,skinObj,nam;
  dimObj = sObj[0];
  skinObj= sObj[1];
  cx = parseInt(t.style.width)+dimObj['topleftcorner'][0]+dimObj['toprightcorner'][0];
  cy = parseInt(t.style.height)+dimObj['topleftcorner'][1]+dimObj['bottomleftcorner'][1];
  if (type==winDefStyle)
    {
      cy += twin_borderheight+dimObj['titleleftcorner'][1];
    }    
  t.style.width = cx;
  t.style.height= cy; 
  for (n in skinObj)  
      {
      if (n == 'topleftcorner')
        {
          t[n] = new domObject(t,'img');
          t[n].Node.src = skinObj[n].src;
          t[n].style.top= 0;  
          t[n].style.left= 0;
        } else
      if (n == 'toprightcorner')
         {
          t[n] = new domObject(t,'img')
          t[n].Node.src = skinObj[n].src;
          t[n].style.top= 0;  
          t[n].style.left=cx-dimObj[n][0]; 
          } else
      if (n=='topborder')
        {
         t[n] = new Canvas(t,dimObj['topleftcorner'][0],0,cx-(dimObj['topleftcorner'][0]+dimObj['topleftcorner'][0]),dimObj[n][1]);
         t[n].style.backgroundImage = "url("+skinObj[n].src+")";
         t[n].style.backgroundRepeat = 'repeat-x';
         t[n].setFontSize(0);        
        } else
      if (n == 'titleleftborder')
          {
           if (type==winDefStyle)
              {
               t[n] = new Canvas(t,0,dimObj['topleftcorner'][1],dimObj[n][0],twin_borderheight);
               t[n].style.backgroundImage = "url("+skinObj[n].src+")";
               t[n].style.backgroundRepeat = 'repeat-y';
               t[n].setFontSize(0);          
              }
          } else
      if (n == 'titleleftcorner')
          {
           if (type==winDefStyle)
              {
              t[n] = new domObject(t,'img')
              t[n].Node.src  = skinObj[n].src;
              t[n].style.top = dimObj['topleftcorner'][1]+twin_borderheight;  
              t[n].style.left= 0;                
              }
          } else
      if (n == 'titlebottom')
          {
           if (type==winDefStyle)
              {
              t[n] = new Canvas(t,dimObj['titleleftcorner'][0],dimObj['topleftcorner'][1]+twin_borderheight,cx-(dimObj['titlerightcorner'][0]+dimObj['titleleftcorner'][0]),dimObj[n][1]);
              t[n].style.backgroundImage = "url("+skinObj[n].src+")";
              t[n].style.backgroundRepeat = 'repeat-x';
              t[n].setFontSize(0);            
              }
          } else
      if (n == 'titlerightcorner')
          {
          if (type==winDefStyle)
              {
              t[n] = new domObject(t,'img')
              t[n].Node.src  = skinObj[n].src;
              t[n].style.top = dimObj['toprightcorner'][1]+twin_borderheight;  
              t[n].style.left= cx-dimObj[n][0];                
              }
          } else
      if (n == 'titlerightborder')
          {
          if (type==winDefStyle)
              {
               t[n] = new Canvas(t,cx-dimObj[n][0],dimObj['toprightcorner'][1],dimObj[n][0],twin_borderheight);
               t[n].style.backgroundImage = "url("+skinObj[n].src+")";
               t[n].style.backgroundRepeat = 'repeat-y';
               t[n].setFontSize(0);          
              }
          } else
       if (n == 'leftborder')
          {
          if (type==winDefStyle)
              {
               t[n] = new Canvas(t,0,dimObj['topleftcorner'][1]+twin_borderheight+dimObj['titleleftcorner'][1],dimObj[n][0],cy-(dimObj['topleftcorner'][1]+twin_borderheight+dimObj['titleleftcorner'][1]+dimObj['bottomleftcorner'][1]));
              } else
          if (type == winFlatStyle)
              {
               t[n] = new Canvas(t,0,dimObj['topleftcorner'][1],dimObj[n][0],cy-(dimObj['topleftcorner'][1]+dimObj['bottomrightcorner'][1]));
              }             
              t[n].style.backgroundImage = "url("+skinObj[n].src+")";
              t[n].style.backgroundRepeat = 'repeat-y';
              t[n].setFontSize(0);          
          } else
      if (n == 'rightborder')       
          {
          if (type==winDefStyle)
              {
               t[n] = new Canvas(t,cx-dimObj[n][0],dimObj['toprightcorner'][1]+twin_borderheight+dimObj['titlerightcorner'][1],dimObj[n][0],cy-(dimObj['toprightcorner'][1]+twin_borderheight+dimObj['titlerightcorner'][1]+dimObj['bottomrightcorner'][1]));
              } else
          if (type == winFlatStyle)
              {
               t[n] = new Canvas(t,cx-dimObj[n][0],dimObj['toprightcorner'][1],dimObj[n][0],cy-(dimObj['toprightcorner'][1]+dimObj['bottomrightcorner'][1]));
              }             
              t[n].style.backgroundImage = "url("+skinObj[n].src+")";
              t[n].style.backgroundRepeat = 'repeat-y';
              t[n].setFontSize(0);          
          } else
      if (n == 'bottomleftcorner')
          {
          t[n] = new domObject(t,'img');
          t[n].Node.src = skinObj[n].src;
          t[n].style.top= cy-dimObj[n][1];  
          t[n].style.left= 0;
          } else
      if (n == 'bottomrightcorner')
          {
          t[n] = new domObject(t,'img')
          t[n].Node.src = skinObj[n].src;
          t[n].style.top= cy-dimObj[n][1];  
          t[n].style.left=cx-dimObj[n][1];           
          } else
      if (n == 'bottomborder')
          {
         t[n] = new Canvas(t,dimObj['bottomleftcorner'][0],cy-dimObj[n][1],cx-(dimObj['bottomleftcorner'][0]+dimObj['bottomrightcorner'][0]),dimObj[n][1]);
         t[n].style.backgroundImage = "url("+skinObj[n].src+")";
         t[n].style.backgroundRepeat = 'repeat-x';
         t[n].setFontSize(0);        
          }
      }
      return [cx,cy];
  }
  
//------------------------------
Window = function (pId,title,x,y,cx,cy,type,skin)
//------------------------------
  {
  var sObj,dim,paId,s;
  if (skin == 0) {skin = winSkins;}
  sObj = skinParse(skin,'');      
  this.winType = type;
  if (pId==0) 
    { 
    this.base = new Canvas(pId,x,y,cx,cy);  
    } else
    { 
    pId.client.style.overflow = 'auto';
    this.base = new Canvas(pId.client,x,y,cx,cy);      
    }    
  this.base.style.filter = "Alpha(Opacity=50)";    
  dim = w_DrawBorder(this.base,type,sObj);    
  if (type==winDefStyle)
     {
      this.title = new Canvas(this.base,sObj[0]['topleftcorner'][0],sObj[0]['topleftcorner'][1],dim[0]-(sObj[0]['topleftcorner'][0]+sObj[0]['topleftcorner'][0]),twin_borderheight);
      this.client= new Canvas(this.base,sObj[0]['topleftcorner'][0],sObj[0]['topborder'][1]+twin_borderheight+sObj[0]['titlebottom'][1],dim[0]-(sObj[0]['topleftcorner'][0]+sObj[0]['topleftcorner'][0]),cy);
      this.client.style.overflow = 'auto';
      this.title.setFontSize(14)
      this.title.setBkColor('black');
      this.title.setTxtColor('white');
      this.title.setBorders('bottom',1,'solid','white');
      this.title.setBorders('right',1,'solid','white');
      this.title.setBorders('top',1,'solid','#808080');
      this.title.setBorders('left',1,'solid','#808080');      
     } else
  if (type==winFlatStyle)
     {
        this.client = new Canvas(this.base,sObj[0]['topleftcorner'][0],sObj[0]['topborder'][1],dim[0]-(sObj[0]['topleftcorner'][0]+sObj[0]['topleftcorner'][0]),cy);
     }
  this.setWindowText(title);
  }

//------------------------------
Window.prototype.setWindowText = function (title)
//------------------------------
    {
    if (this.winType == winDefStyle) this.title.setText(title);
    }
    
x = new Window(0,'.:: Debug Window ::.',10,10,350,200,winDefStyle,0)
x.client.Node.innerHTML = DObject(x.client.Node.style);
</script>
</BODY>
</HTML>


---------------------------
ServerOp: LogicSoft
 

the function exists

I can't find it.

The error I get refers to a function called gf_PreloadIMG - which does not exist in any of the files available.

Having said that, it might well be in "macros.js" - which is NOT available, and that may be the cause of your problem.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
hmm....gf_PreloadIMG is in macros.js. there is no way it could execute that far without needing macros.js. that is why i dnt know what to do

---------------------------
ServerOp: LogicSoft
 
people u won't believe this. it wasn't working because of the extension name being in capslock, i ddnt think this mattered. anyway, i have changed the name from macros.JS to macros.js and this is working....problem 1 solved. cheers billy ray.

now if u try this link something should show up..


---------------------------
ServerOp: LogicSoft
 
problem 2. i would like u to preview that page with IE, Netscape and firefox. for some reason mozilla based browsers cannot render well untill i refresh.

---------------------------
ServerOp: LogicSoft
 

It is probably because your home pc (running Windows) does not have case-sensitive filenames, but your web server (most likely a unix box) does.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
i know "Alpha(Opacity=50)" is an IE filter but i thought with the next generation browsers like netscape 7. could perform this filter. please advise.

also if you open this link in mozilla,netscape or firefox. the skin is not wrapped around the div until u force a refresh check it out



---------------------------
ServerOp: LogicSoft
 

Use this to get 50% opacity in most browsers that support it:

Code:
opacity: 0.5;
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Code:
-moz-opacity: 0.5;
-khtml-opacity: 0.5;

waddya mean? for mozilla i have to use -moz-opacity:0.5 other than alpha? or do you mean i use 0.5 instead of 50%.

also have u noticed that u have to refresh to get a better rendering using mozilla based browsers?

---------------------------
ServerOp: LogicSoft
 
hmmm....i think my problem is arising from the fact that im preloading my images and using them straight away. maybe i should use roll-over examples to help me out. im so damn. .

---------------------------
ServerOp: LogicSoft
 

waddya mean?

"waddi" mean is what I said: "Use this to get 50% opacity in most browsers that support it".

The code I provided shows how to achieve 50% opacity in the browsers that support it.

To explain further: Different browsers support opacity in different ways, and use different units to specify the opacity. IE uses numbers 0-100 (in units of 1), and most others use numbers 0-1 (in units of 0.01). The number of steps between the two are the same, and you get one from the other by multiplying (or dividing) by 100.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
In reference to your post about filters, the reason that Netscape/Firefox/Mozilla do not support it, is because they are not a part of the Internet Standards (defined by w3.org and other organizations).

However, the problem, at least up to now, has been that there was no standard for making things transparent. As a result, Mozilla (and it also appears KHTML) implemented a proprietary opacity feature.
[As a little side note, according to the CSS standards, when a company implements a proprietary CSS feature, they are supposed to write it in the form of -vendorname-feature or _vendorname-feature. (Source: That's why you have -moz-opacity and -khtml-opacity, for Mozilla's special implementation and KHTML's special implementation. Neither of these two features are a part of official Internet standards, however.]

On the other, CSS3 (a standard that is currently in development) defines a new CSS features called opacity. This new feature will use a number ranginge from 0 to 1 to define different levels of opacity. Although, I kind of agree with you that this is an odd idea, it is what seems to be what they decided on. I even asked about this particular choice, which you can read about here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top