Subversion Repositories wimsdev

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.         DynAPI Distribution
  3.         HTMLRollover Class - a wrapper around XImage and HTMLHyperLink
  4.  
  5.         The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
  6.        
  7.         Requires: HTMLHyperLink
  8. */
  9.  
  10.  
  11. function HTMLRollover(css,w,h,offSrc,onSrc,dnSrc,url,title){
  12.         this.HTMLHyperLink = HTMLHyperLink;
  13.         this.HTMLHyperLink(css,null,url,title);
  14.  
  15.         this._imgid=this.id+'HRO';
  16.         this._img =  dynapi.functions.getImage(offSrc,w,h,{
  17.                 name    :this._imgid,
  18.                 link    :url,
  19.                 oversrc :onSrc,
  20.                 downsrc :dnSrc,
  21.                 tooltip :title,
  22.                 onclick         :this+"._e('click',anc)",
  23.                 onmouseout      :this+"._e('mouseout',anc)",
  24.                 onmouseover     :this+"._e('mouseover',anc)",
  25.                 onmousedown     :this+"._e('mousedown',anc)"
  26.         });
  27.        
  28. };
  29. var p = dynapi.setPrototype('HTMLRollover','HTMLHyperLink');
  30. p.getInnerHTML = function(){
  31.         var h=this._img.getHTML();
  32.         // attach id,name and class to <a>
  33.         h=h.replace(/\<a/,'<a id="'+this.id+'" name="'+this.id+'" class="'+this._class+'"');
  34.         return h;
  35. };
  36. p.setBorder = function(w) {
  37.         w=w||0;
  38.         this._img.params.border=w;
  39.         if(this.getElm()) {
  40.                 img=this.doc.images[this._imgid];
  41.                 if(img) img.border=w;
  42.         }
  43. };
  44. p.setSrc = function(src){
  45.         if(this.getElm()) {
  46.                 img=this.doc.images[this._imgid];
  47.                 if(img) img.src=src;
  48.         }
  49. };