Guide functions and properties

 < Day Day Up > 

Guide functions and properties let you display, manipulate, and delete guides that let users measure and lay out elements on their HTML pages.

dom.clearGuides()

Availability

Dreamweaver 8.

Description

This function determines whether to delete all guides in the document.

Arguments

None.

Returns

Nothing.

Example

The following example deletes all guides in the document if the document has at least one guide:

 var currentDOM = dw.getDocumentDOM();   if (currentDOM.hasGuides() == true) {   currentDOM.clearGuides(); } 

dom.createHorizontalGuide()

Availability

Dreamweaver 8.

Description

This function creates a horizontal guide at the current location in the document.

Arguments

 location 

  • The location argument is the location of the guide with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

Nothing.

Example

The following example creates a horizontal guide in the document at the current location:

 var currentDOM = dw.getDocumentDOM(); currentDOM.createHorizontalGuide("10px"); 

dom.createVerticalGuide()

Availability

Dreamweaver 8.

Description

This function creates a vertical guide at the current location in the document.

Arguments

 location 

  • The location argument is the location of the guide with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

Nothing.

Example

The following example creates a vertical guide in the document at the current location:

 var currentDOM = dw.getDocumentDOM(); currentDOM.createVerticalGuide("10px"); 

dom.deleteHorizontalGuide()

Availability

Dreamweaver 8.

Description

This function deletes the horizontal guide at the specified location.

Arguments

 location 

  • The location argument is a string that represents the location in the document to test, with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

Nothing.

Example

The following example deletes the horizontal guide at the specified location in the document:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasHorizontalGuide("10px") == true) {   currentDOM.deleteHorizonalGuide("10px"); } 

dom.deleteVerticalGuide()

Availability

Dreamweaver 8.

Description

This function deletes the vertical guide at the specified location.

Arguments

 location 

  • The location argument is a string that represents the location in the document to test, with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

Nothing.

Example

The following example deletes the vertical guide at the specified location in the document:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasVerticalGuide("10px") == true) {   currentDOM.deleteVerticalGuide("10px"); } 

dom.guidesColor

Availability

Dreamweaver 8.

Description

This mutable color property determines the color of guides in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example makes guides gray:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesColor != "#444444"){   currentDOM.guidesColor = "#444444";   } 

dom.guidesDistanceColor

Availability

Dreamweaver 8.

Description

This mutable color property determines the distance feedback color of guides in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example makes the distance feedback color of guides gray:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesDistanceColor != "#CCCCCC"){   currentDOM.guidesDistanceColor = "#CCCCCC";  } 

dom.guidesLocked

Availability

Dreamweaver 8.

Description

This mutable Boolean property determines whether guides are locked in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example locks guides if they are not locked:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesLocked == false) {   currentDOM.guidesLocked = true; } 

dom.guidesSnapToElements

Availability

Dreamweaver 8.

Description

This mutable Boolean property determines whether guides snap to elements in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example makes guides in the document snap to elements:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesSnapToElements == false) {   currentDOM.guidesSnapToElements = true;  } 

dom.guidesVisible

Availability

Dreamweaver 8.

Description

This mutable Boolean property determines whether guides are visible in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example turns guides on if they are not visible:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesVisible == false) {   currentDOM.guidesVisible = true; } 

dom.hasGuides()

Availability

Dreamweaver 8.

Description

This function determines whether the document has at least one guide. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example deletes all guides in the document if the document has at least one guide:

 var currentDOM = dw.getDocumentDOM();   if (currentDOM.hasGuides() == true) {   currentDOM.clearGuides(); } 

dom.hasHorizontalGuide()

Availability

Dreamweaver 8.

Description

This function determines whether the document has a horizontal guide at the specified location.

Arguments

 location 

  • The location argument is a string that represents the location in the document to test, with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

A Boolean value: true if there is a horizontal guide at the location; false otherwise.

Example

The following example deletes all guides in the document if the document has a horizontal guide at the specified location:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasHorizontalGuide("10px") == true) {   currentDOM.clearGuides(); } 

dom.hasVerticalGuide()

Availability

Dreamweaver 8.

Description

This function determines whether the document has a vertical guide at the current location.

Arguments

 location 

  • The location argument is a string that represents the location in the document to test, with both the value and units as one string, with no space between the value and units. The possible units are "px" for pixels and "%" for percentage. For example, to specify 10 pixels, location = "10px"; to specify 50 percent, location = "50%".

Returns

A Boolean value: true if there is a vertical guide at the location; false otherwise.

Example

The following example deletes all guides in the document if the document has a vertical guide at the specified location:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasVerticalGuide("10px") == true) {   currentDOM.clearGuides(); } 

dom.snapToGuides

Availability

Dreamweaver 8.

Description

This mutable Boolean property determines whether elements snap to guides in the document. You can set and get this property.

Arguments

None.

Returns

Nothing.

Example

The following example makes elements in the document snap to guides:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.snapToGuides == false) {   currentDOM.snapToGuides = true; } 

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net