FPHTMLBGsound Object
FPHTMLBGsound Multiple objects |
Represents the BGSOUND element in an HTML document. The BGSOUND element plays a sound file in the background when a document is loaded into a browser. Use the FPHTMLBGsound object to specify the location of an audio file and looping characteristics of the background sound. See also the IHTMLBGsound object.
Using the FPHTMLBGsound object
Use the Item method to return an FPHTMLBGsound object. The following example inserts the BGSOUND element into the specified document and sets the src and loop attributes according to the values passed into the function.
Function InsertBGSound(objdoc As FPHTMLDocument, strSRC As String, _
Optional intLoops As Integer) As Boolean
Dim objBGSound As FPHTMLBGsound
Dim intNumber As Integer
Dim objHead As IHTMLElement
On Error GoTo InsertBGSoundError
intNumber = objdoc.body.all.Length
Set objHead = objdoc.all.tags("head").Item(0)
objHead.insertAdjacentHTML "beforeend", _
"<BGSOUND id=""bgsound" & intNumber & """>"
Set objBGSound = objdoc.all.tags("bgsound") _
.Item(CVar("bgsound" & intNumber))
With objBGSound
.src = strSRC
If intLoops <> 0 Then
.loop = intLoops
Else
.loop = "infinite"
End If
End With
InsertBGSound = True
ExitFunction:
Exit Function
InsertBGSoundError:
InsertBGSound = False
GoTo ExitFunction
End Function
Use the following example to call the preceding function. This example assumes that you have a sound file called "song.avi" in your Web site in a subfolder called "Sounds." To see the BGSOUND element as it would function in a browser, replace the String "../sounds/song.avi" with the path and filename of a valid sound file in your Web site.
Sub CallInsertBGSound()
MsgBox InsertBGSound(ActiveDocument, "../sounds/song.avi", 5)
End Sub
Properties | all Property | balance Property | children Property | className Property | Document Property | filters Property | id Property | innerHTML Property | innerText Property | isTextEdit Property | lang Property | language Property | loop Property | offsetHeight Property | offsetLeft Property | offsetParent Property | offsetTop Property | offsetWidth Property | onafterupdate Property | onbeforeupdate Property | onclick Property | ondataavailable Property | ondatasetchanged Property | ondatasetcomplete Property | ondblclick Property | ondragstart Property | onerrorupdate Property | onfilterchange Property | onhelp Property | onkeydown Property | onkeypress Property | onkeyup Property | onmousedown Property | onmousemove Property | onmouseout Property | onmouseover Property | onmouseup Property | onrowenter Property | onrowexit Property | onselectstart Property | outerHTML Property | outerText Property | parentElement Property | parentTextEdit Property | recordNumber Property | sourceIndex Property | src Property | style Property | tagName Property | title Property | volume Property
Methods | click Method | contains Method | getAttribute Method | insertAdjacentHTML Method | insertAdjacentText Method | removeAttribute Method | scrollIntoView Method | setAttribute Method | toString Method
Parent Objects
Child Objects | IHTMLElement Object | IHTMLFiltersCollection Object | IHTMLStyle Object