SetProperties Function

Description

This function is for use in conjunction with the custom properties dialog. This function, when given a string of relevant name-value pairs, sets the attributes for an instance of a specific tag within EditLive! for XML. For more information on how to use custom properties dialogs with EditLive! for XML please see Custom Properties Dialogs for EditLive! for XML.

Syntax

JavaScript

SetProperties(strProperties);

Parameters

strProperties

This string provides a list of name-value pairings of attributes for the relevant HTML tag. Each name and value for each pairing must be delimited by a nequals (=) character. Name-value pairings must be delimited by a new line (\n) character.

Note

This string must be URL encoded. It is recommended that this encoding is done via a server-side URL encoding method. Encoding can be achieved using the JavaScript escape function, however, this is not recommended as the escape function does not fully comply with the URL encoding standards.

Example

Example 17.10. SetProperties Runtime Function Example

The following sets the properties for an instance of a tag inside an instance of EditLive! for XML named editlivejs.

//set up an instance of EditLive!
var editlivejs;
editlivejs = new EditLiveXML("editlive",700,400);
editlivejs.setDownloadDirectory("editlivexml");
editlivejs.setLocalDeployment(false);
editlivejs.setConfigurationFile("sample_config.xml");
editlivejs.show();
...
//create a function which sets properties
function setNewProperties(newProperties){
  editlivejs.SetProperties(newProperties);
}

Remarks

Each name and value for each pairing must be delimited by an equals (=) character.

Name-value pairings must be delimited by a new line (\n) character.

In order to correctly set the properties of the relevant tag it should be ensured that the ephoxTagID attribute is not altered by the functions external to EditLive! for XML. Also, the tag attribute must be present and the value of this attribute must correspond to the name of the tag (i.e. span for a <span> tag).

The value of the attribute with the name of tag designates the type of tag for which the properties are relevant. Changing the value of the tag attribute will change the tag type in EditLive! for XML. Thus, if the value of a tag attribute with the value td was changed to th then the relevant table cell would be changed from a normal (td) cell to a table header (th) cell.

The tag for which the custom properties dialog applies may contain standalone attributes. These are attributes which have only a name and do not exist as a name-value pairing. For example, the NOWRAP attribute of the <td> tag. In order to add such an attribute to the properties string a name-value pair in which the name and value are the same (e.g. NOWRAP=NOWRAP) should be added to the properties string.

See Also