BUI logoDWC logoBBjWebManager::getAttribute

Description

In BBj 22.03 and higher, this method returns the value of a component attribute on the web page.

Note:

In BBj 22.03 and higher, BBjWebManager is an alias for BBjBuiManager.

Syntax

Return Value Method

void

getAttribute(String attribute)
void getAttribute(String attribute, String selector)

Parameters

Parameter Description
attribute Specifies an attribute to be retrieved from the web page.
selector By default, getAttribute applies to the document element on the web page. If a selector is specified, it selects a descendant element within the document to query this attribute. If a specified selector doesn't return any elements, the default document element is used.

Return Value

Returns the value of this attribute.

Example

rem ' BBjWebManager::getAttribute

attribute$ = "lang"
value$ = "en-US"
selector$ = ""

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()

title$ = "BBjWebManager::getAttribute"
window! = sysgui!.addWindow(25,25,600,275,title$,$00090083$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")

window!.addStaticText(101,5,25,90,25,"Attribute:",$8000$)
attribute! = window!.addEditBox(102,100,25,475,25,attribute$,$$)

window!.addStaticText(103,5,75,90,25,"Value:",$8000$)
value! = window!.addEditBox(104,100,75,475,25,value$,$$)

window!.addStaticText(105,5,125,90,25,"Selector:",$8000$)
selector! = window!.addEditBox(106,100,125,475,25,selector$,$$)

setAttribute! = window!.addButton(1,100,175,475,25,"setAttribute",$$)
setAttribute!.setCallback(setAttribute!.ON_BUTTON_PUSH,"setAttribute")

getAttribute! = window!.addButton(2,100,225,475,25,"getAttribute",$$)
getAttribute!.setCallback(getAttribute!.ON_BUTTON_PUSH,"getAttribute")

browser! = bbjapi().getWebManager(err=oops)
browser!.getUrl(err=oops)

process_events

oops:
i = msgbox("This functionality is only supported in browser environments.")

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    width = event!.getWidth()
    height = event!.getHeight()
    attribute!.setSize(width-125,25)
    value!.setSize(width-125,25)
    selector!.setSize(width-125,25)
    setAttribute!.setSize(width-125,25)
    getAttribute!.setSize(width-125,25)
return

setAttribute:
    attribute$ = attribute!.getText()
    value$ = value!.getText()
    selector$ = selector!.getText()
    browser!.setAttribute(attribute$, value$, selector$)
return

getAttribute:
    attribute$ = attribute!.getText()
    selector$ = selector!.getText()
    value$ = browser!.getAttribute(attribute$, selector$)
    value!.setText(value$)
return

See Also

BBjAPI

BBjSysGui

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.