Partilhar via


targetelement Attribute

  Microsoft Speech Technologies Homepage

Specifies the element of an HTML page where the value attribute of the bind element is assigned.

HTML <bind targetelement = "targetElement">
JScript bind.targetelement = "targetElement"

Remarks

Using the targetelement attribute, an application can easily and automatically place retrieved recognition results into a Web page element such as a text box or text field.

The result of a successful recognition is an Extensible Markup Language (XML) document defined using Semantic Markup Language (SML). SML labels specific words or phrases within the recognition result. Those specific words or phrases are assigned to the value attribute of the bind element. The value attribute is then bound to controls on a Web page or to a script variable.

The targetelement attribute refers to one of two features.

  • If targetelement is an HTML page control, the value attribute of the bind element is placed directly into that control. For example, if targetelement is a text box on the current HTML page, value is assigned to that text box where the recognized word or phrase is displayed.
  • If targetelement is not an HTML page control, value is assigned to a string variable that is created as needed. Once assigned the value attribute, that variable is treated as a conventional variable within the restrictions of the script or language in use.

Example

The following code demonstrates the use of the targetelement attribute:

<salt:listen id="listen1" mode="automatic" onreco="Handleonreco()" onnoreco="Handleonnoreco()"  onsilence="Handleonsilence()" onerror="Handleonerror()">
  <salt:grammar id="gram1" src="./cities.grxml"/> 
  <salt:bind targetelement="boxFromCity" targetattribute="value" value="//origin_city"/>
  <salt:bind targetelement="boxToCity" targetattribute="value" value="//destination_city"/>
</salt:listen>

See Also

bind Element |  targetattribute Attribute | value Attribute | bind Element Example