⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsslider.js

📁 tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛
💻 JS
📖 第 1 页 / 共 3 页
字号:
      if (this._trackHidden)
      {
        outerHeight += this._ticksMargin + this._trackImageDimension;
      }
      tickWidth = 1;
      tickHeight = outerHeight;
    }
    else
    {
      outerTop = this._widgetMargin + this._trackImageDimension;
      if (this._ticksBeforeTrack)
      {
        outerLeft = this._widgetMargin;
      }
      else
      {
        outerLeft = this._widgetMargin + this._trackImageDimension + this._ticksMargin;
      }
      ticksLength = this._widgetHeight - 2*this._widgetMargin -
        2*this._trackImageDimension;
      outerWidth = this._ticksThickness;
      if (this._trackHidden)
      {
        outerWidth += this._ticksMargin + this._trackImageDimension;
      }
      outerHeight = ticksLength;
      tickWidth = outerWidth;
      tickHeight = 1;
    }
    if (numberOfTicks > 1)
    {
      if (ticksLength < numberOfTicks)
      {
        numberOfTicks = ticksLength; // unable to draw any more than this
      }
    }
    if (this._customImage != null)
    {
      sb.append("<img style=\"position: absolute; top: ");
      sb.append(outerTop);
      sb.append("px; left: ");
      sb.append(outerLeft);
      sb.append("px; width: ");
      sb.append(outerWidth);
      sb.append("px; height: ");
      sb.append(outerHeight);
      sb.append("px;\" src=\"");
      sb.append(this._customImage);
      sb.append("\"/>");
    }
    sb.append("<div style=\"position: absolute; top: ");
    sb.append(outerTop);
    sb.append("px; left: ");
    sb.append(outerLeft);
    sb.append("px; width: ");
    sb.append(outerWidth);
    sb.append("px; height: ");
    sb.append(outerHeight);
    sb.append("px;\">");
    for (var t=0; t<numberOfTicks; t++)
    {
      sb.append("<div style=\"position: absolute; top: ");
      if (this._horizontalLayout)
      {
        sb.append("0px; left: ");
        var tickLeft = ticksLength*t/(numberOfTicks-1);
        sb.append(tickLeft);
      }
      else
      {
        var tickTop;
        if (t == 0 && numberOfTicks == 1)
        {
          tickTop = ticksLength;
        }
        else
        {
          tickTop = ticksLength*t/(numberOfTicks-1);
        }
        sb.append(tickTop);
        sb.append("px; left: 0");
      }
      sb.append("px; width: ");
      sb.append(tickWidth);
      sb.append("px; height: ");
      sb.append(tickHeight);
      sb.append("px; background-color: ");
      sb.append(this._tickColor);
      sb.append(";\"><img src=\"");
      sb.append(this._spacerImage);
      sb.append("\" style=\"width: 0px; height: 0px;\"/></div>");
    }
    sb.append("</div>");
  }
}

JSSlider.prototype._appendTrackOutline = function(sb)
{
  var top, left, width, height, midTop, midLeft, midWidth, midHeight, midImage,
      rangeTop, rangeLeft, rangeWidth, rangeHeight, rangeImage,
      startTop, startLeft, startImage, endTop, endLeft, endImage;
  var effectiveTickThickness = 0;
  if ( (this._numTicks > 0) || (this._customImage != null) )
  {
    effectiveTickThickness = this._ticksThickness + this._ticksMargin;
  }
  if (this._horizontalLayout)
  {
    if (this._ticksBeforeTrack)
    {
      top = this._widgetMargin + effectiveTickThickness;
    }
    else
    {
      top = this._widgetMargin;
    }
    left = this._widgetMargin;
    width = this._widgetWidth - 2*this._widgetMargin;
    height = this._trackImageDimension;
    startTop = 0;
    startLeft = 0;
    startImage = this._horizontalTrackStartImage;
    midTop = 0;
    midLeft = this._trackImageDimension;
    midWidth = width - 2*this._trackImageDimension;
    midHeight = this._trackImageDimension;
    midImage = this._horizontalTrackMidImage;
    endTop = 0;
    endLeft = width - this._trackImageDimension;
    endImage = this._horizontalTrackEndImage;
    if (this._rangeSlider)
    {
      var startAndSize = this._getRangeBarStartAndSize();
      rangeTop = 0;
      rangeLeft = startAndSize["start"]; // variable
      rangeWidth = startAndSize["size"]; // variable
      rangeHeight = this._trackImageDimension;
      rangeImage = this._horizontalTrackRangeImage;
    }
  }
  else
  {
    top = this._widgetMargin;
    if (this._ticksBeforeTrack)
    {
      left = this._widgetMargin + effectiveTickThickness;
    }
    else
    {
      left = this._widgetMargin;
    }
    width = this._trackImageDimension;
    height = this._widgetHeight - 2*this._widgetMargin;
    startTop = height - this._trackImageDimension;
    startLeft = 0;
    startImage = this._verticalTrackStartImage;
    midTop = this._trackImageDimension;
    midLeft = 0;
    midWidth = this._trackImageDimension;
    midHeight = height - 2*this._trackImageDimension;
    midImage = this._verticalTrackMidImage;
    endTop = 0;
    endLeft = 0;
    endImage = this._verticalTrackEndImage;
    if (this._rangeSlider)
    {
      var startAndSize = this._getRangeBarStartAndSize();
      rangeTop = startAndSize["start"]; // variable
      rangeLeft = 0;
      rangeWidth = this._trackImageDimension;
      rangeHeight = startAndSize["size"]; // variable
      rangeImage = this._verticalTrackRangeImage;
    }
  }
  sb.append("<div style=\"position: absolute; top: ");
  sb.append(top);
  sb.append("px; left: ");
  sb.append(left);
  sb.append("px; width: ");
  sb.append(width);
  sb.append("px; height: ");
  sb.append(height);
  sb.append("px;\">");
  
  // start track image
  sb.append("<img style=\"position: absolute; top: ");
  sb.append(startTop);
  sb.append("px; left: ");
  sb.append(startLeft);
  sb.append("px; width: ");
  sb.append(this._trackImageDimension);
  sb.append("px; height: ");
  sb.append(this._trackImageDimension);
  sb.append("px;\" src=\"");
  sb.append(startImage);
  sb.append("\"/>");
  
  // mid track image (stretches)
  sb.append("<img style=\"position: absolute; top: ");
  sb.append(midTop);
  sb.append("px; left: ");
  sb.append(midLeft);
  sb.append("px; width: ");
  sb.append(midWidth);
  sb.append("px; height: ");
  sb.append(midHeight);
  sb.append("px; background-image: url('");
  sb.append(midImage);
  sb.append("');\" src=\"");
  sb.append(this._spacerImage);
  sb.append("\"/>");
  
  // end track image
  sb.append("<img style=\"position: absolute; top: ");
  sb.append(endTop);
  sb.append("px; left: ");
  sb.append(endLeft);
  sb.append("px; width: ");
  sb.append(this._trackImageDimension);
  sb.append("px; height: ");
  sb.append(this._trackImageDimension);
  sb.append("px;\" src=\"");
  sb.append(endImage);
  sb.append("\"/>");
  
  // range bar (stetches)
  if (this._rangeSlider)
  {
    sb.append("<img id=\"");
    sb.append(this._id);
    sb.append(JSSlider._ID_RANGE_BAR);
    sb.append("\" style=\"position: absolute; top: ");
    sb.append(rangeTop);
    sb.append("px; left: ");
    sb.append(rangeLeft);
    sb.append("px; width: ");
    sb.append(rangeWidth);
    sb.append("px; height: ");
    sb.append(rangeHeight);
    sb.append("px; background-image: url('");
    sb.append(rangeImage);
    sb.append("');\" src=\"");
    sb.append(this._spacerImage);
    sb.append("\"/>");
  }
  
  sb.append("</div>");
}

JSSlider.prototype._appendMarker = function(sb, percent0To100, markerId)
{
  var width, height, image, cursor;
  if (this._horizontalLayout)
  {
    width = this._horizontalMarkerWidth;
    height = this._horizontalMarkerHeight;
    image = this._horizontalMarkerImage;
    cursor = "pointer";
  }
  else
  {
    width = this._verticalMarkerWidth;
    height = this._verticalMarkerHeight;
    image = this._verticalMarkerImage;
    cursor = "pointer";
  }
  var top = this._getMarkerTop(percent0To100);
  var left = this._getMarkerLeft(percent0To100);
  
  sb.append("<a id=\"");
  sb.append(markerId);
  sb.append("\" href=\"javascript:;\" style=\"position: absolute; top: ");
  sb.append(top);
  sb.append("px; left: ");
  sb.append(left);
  sb.append("px; cursor: ");
  sb.append(cursor);
  sb.append(";\" onkeydown=\"return window['");
  sb.append(this._id);
  sb.append("'].markerKeyDown(this,event)\" onmousedown=\"window['");
  sb.append(this._id);
  sb.append("'].markerDragged(this,event)\" onmousemove=\"if(document.all){window['");
  sb.append(this._id);
  sb.append("'].markerMoved(event);}\" onmouseup=\"if(document.all){window['");
  sb.append(this._id);
  sb.append("'].markerReleased(event)}\"><img align=\"top\" border=0 src=\"");
  sb.append(image);
  sb.append("\" style=\"width: ");
  sb.append(width);
  sb.append("px; height: ");
  sb.append(height);
  sb.append("px;\"/></a>");
}


function DhtmlStringBuffer()
{
  this.maxStreamLength = (document.all?100:10000);
  this.data = new Array(100);
  this.iStr = 0;
  this.append = function(obj)
  {
    this.data[this.iStr++] = obj;
    if (this.data.length > this.maxStreamLength)
    {
      this.data = [this.data.join("")];
      this.data.length = 100;
      this.iStr = 1;
    }
    return this;
  };
  this.toString = function()
  {
    return this.data.join("");
  };
}

DhtmlStringBuffer._joinFunc = Array.prototype.join;

DhtmlStringBuffer.concat = function()
{
  arguments.join = this._joinFunc;
  return arguments.join("")
}



      function reposRangeBarHChanged(newStartPercent0To100, newEndPercent0To100)
      {
        reposRangeSliderV.setMarkerPercent(newStartPercent0To100, newEndPercent0To100);
      }

      function reposRangeBarVChanged(newStartPercent0To100, newEndPercent0To100)
      {
        reposRangeSliderH.setMarkerPercent(newStartPercent0To100, newEndPercent0To100);
      }



      function DefaultValChangedListener(ElementId, newStartPercent0To100, newEndPercent0To100, MaxVal)
      {
        var slideVal = Math.round(100*newStartPercent0To100)/100;
        document.getElementById("slideval").value = slideVal
      }





JSSlider._ID_WIDGET = "sliderWidget";
JSSlider._ID_RANGE_BAR = "sliderRangeBar";
JSSlider._ID_START_MARKER = "sliderStartMarker";
JSSlider._ID_END_MARKER = "sliderEndMarker";
JSSlider._KEY_CODE_ARROW_RIGHT = 39;
JSSlider._KEY_CODE_ARROW_LEFT = 37;
JSSlider._KEY_CODE_ARROW_UP = 38;
JSSlider._KEY_CODE_ARROW_DOWN = 40;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -