behavior Property

Microsoft FrontPage Visual Basic

behavior Property

Returns or sets a String that represents how text scrolls in a marquee.

expression.behavior

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The String for the behavior property can be one of the following values:

scroll Marquee scrolls in the direction specified by the direction property. The text scrolls off the end and starts over. Default value.
alternate Marquee's scroll direction reverses when its content reaches the edge of the container.
slide Marquee scrolls in the direction specified by the direction property. The text scrolls to the end and stops.

Example

The following example inserts a MARQUEE element into the specified document at the insertion point, and then sets the scroll behavior and direction, the number of times to loop, and the height, width, and font and border formatting of the new element.

    Sub InsertMarquee(ByRef objDoc As FPHTMLDocument, ByRef strText As String, _
        strBehavior As String, strDirection As String, intLoop As Integer, _
        strHeight As String, strWidth As String, strFont As String, _
        blnBold As Boolean, blnItalic As Boolean, strBorderColor As String)

    Dim objRange As IHTMLTxtRange
    Dim objMarquee As FPHTMLMarqueeElement
    Dim intCount As Integer
    Dim strID As String

    intCount = objDoc.all.tags("marquee").Length
    strID = "marquee" & intCount + 1
    
    Set objRange = objDoc.Selection.createRange
    
    objRange.collapse
    objRange.pasteHTML "<marquee id=""" & strID & """></marquee>"

    Set objMarquee = objDoc.all.tags("marquee").Item(CVar(strID))

    With objMarquee
        .behavior = strBehavior
        .direction = strDirection
        .loop = intLoop
        .Height = strHeight
        .Width = strWidth
        With .Style
            .fontFamily = strFont
            If blnBold = True Then .fontWeight = "bold"
            If blnItalic = True Then .fontStyle = "italic"
            .Border = strBorderColor
        End With
        .innerText = strText
    End With

End Sub
  

Use the following example to call the preceding subroutine.

    Sub CallInsertMarquee()

    Call InsertMarquee(objDoc:=ActiveDocument, strText:="This is my Web page.", _
        strBehavior:="alternate", strDirection:="up", intLoop:="-1", strHeight:="100%", _
        strWidth:="10%", strFont:="broadway", blnBold:=True, blnItalic:=True, _
        strBorderColor:="red")

End Sub