Heim >Web-Frontend >js-Tutorial >javascript之可拖动的iframe效果代码_javascript技巧
// HISTORY
// ------------------------------------------------------------------
// Jan 23, 2004: Fixed problems which caused the script not to work in
// some framed situations. Improved browser support.
// Added easier "addHandle" implentation.
// May 25, 2003: Added better event position detection, added caching
// of IFRAME object references to avoid lookups. Added
// 'move' cursor to handles.
// May 24, 2003: Updated to fix bug with Netscape 7.x
// May 23, 2003: Created
/*
DESCRIPTION: The purpose of this library is to allow IFRAME objects to be
dragged around the screen in the same way that popup windows or draggable
DIV tags are often used. Since IFRAME objects always cover form objects,
this makes an ideal solution for a simulated "popup window" on a page with
form objects.
COMPATABILITY: Tested successfully with IE 6.x, Netscape 6.2, 7.x, and
Mozilla 1.3. Since this script uses IFRAME objects and DHTML heavily,
cross-browser compatability is a goal but there may be some quirks in
various browser versions.
USAGE:
1) Include the source file in your main document which contains the IFRAME
tags. Make sure each iframe has a unique "ID" attribute. For best browser
compatability, also include a "NAME" attribute in the IFRAME tag that
has the same value as the "ID" attribute.
2) In the document content of each IFRAME which will be draggable, , do two
things:
a) Include the dragiframe.js file in the source
b) add this code to the