Class FWTag

This class represents a tag. The attributes appear as normal properties, so you can add or change them by setting them as properties.

You can construct these by using fwAdd and fwAddEnclosing. This class is a subclass of Class FWOutput.

Example: 1:
The following Action will name all the images foobar0, foobar1, foobar2, etc. You can construct these by using fwAdd and fwAddEnclosing. This class is a subclass of Class FWOutput.

<page-action name="Name all img"> 
<action-javascript> 
function fwAfterEndBody() 
{ 
    // find all the <img> tags that belong to this item 
    var images = fwDocument.fwTags.fwFindAll("img"); 
    for (i in images) 
    { 
        var image = images[i]; 
        image.name = '"'+'foobar'+i+'"'; 
    } 
} 
</action-javascript> 
</page-action> 

Example: 2:
The following Action will name all the images without names, so that the first will have name=”foobar0”, the second will have name=” foobar1”, then name=” foobar2” etc

<page-action name="Name all unnamed img"> 
<action-javascript> 
function fwAfterEndBody() 
{ 
    // find all the <img> tags that belong to this item 
    var j = 0; 
    var images = fwDocument.fwTags.fwFindAll("img"); 
    for (i in images) 
    { 
        var image = images[i]; 
        if (!image.name) 
        { 
            image.name = '"'+'foobar'+j+'"'; 
            j++; 
        } 
    } 
} 
</action-javascript> 
</page-action> 

Properties (2)

fwClose

This determines if the closing form of the tag is written. e.g. the </p> of a <p> tag.

fwOwner

The primary element that created this tag.

Method

fwAddJToTag(name,value)

This method is designed to make it easier to append JavaScript statements to tag values. Your value is appended to the end of any existing value but before the statement return true or return false.

Arguments:
* name: the names of the argument to addvalue the argument to add

Example:
This will add two alert calls to the onclick of the enclosing link so that it is terminated with return false.

<item-action name="Click Alert"> 
<action-javascript> 
function fwAfterEndBody() 
{ 
    // find all the <img> tags 
    var image = fwDocument.fwTags.fwFind("img"); 
    var link = image.fwFindEnclosing("a"); 
    link.fwAddJToTag("onclick","return false"); 
    link.fwAddJToTag("onclick","alert('click')"); 
    link.fwAddJToTag("onclick","alert('click again')"); 
} 
</action-javascript> 
</item-action>

Register or log in to view or add comments.

FreewayTalk

Join the friendliest community on the Net at FreewayTalk. Ask and answer questions about Softpress Freeway, or just gather around the virtual water cooler!