April 22, 2000 - The Clipping Region | WebReference

April 22, 2000 - The Clipping Region

Yehuda Shiran April 22, 2000
The Clipping Region
Tips: April 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

The clipping area of a DHTML element is the visible area of the element. While in Netscape Navigator the creation of a clipping area is as simple as property assignment, you need to use the rect() constructor in Internet Explorer:

if (IE4){
  canvas.style.clip = "rect(0 " + canvasWidth + " " + canvasHeight + " 0)";
}
else {
  canvas.clip.width = canvasWidth;
  canvas.clip.height= canvasHeight;
}

Learn more from a real example that uses this clipping region in Column 32, Setting Up the Viewing Area.