Share via


value Element

  Microsoft Speech Technologies Homepage

Retrieves the value of an element in an HTML document. Optional.

<value targetelement="elementID" targetattribute="attName" />

Remarks

The targetelement attribute refers to an element within the current HTML document. The content of the element whose name is specified by the targetelement attribute is inserted into the text to be synthesized. If the content is contained in a property or attribute of the element, the targetattribute attribute specifies that property or attribute on targetelement. If omitted, no attribute is used and the value defaults to the content (text or Extensible Markup Language (XML)) of the element. This capability is useful for referring to values in HTML form controls, such as a text box.

Example

The following code demonstrates the use of the value element and its attributes. Click the Start Prompt button. The prompt will speak, but uses the names in the From City and To City text boxes as part of the prompt. The city name may be changed before playing the prompt. The value properties of the "fromCity" and "toCity" controls are inserted into the text before the prompt is output.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <head>
    <object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>
  </head>

  <body>
    <?import namespace="salt" implementation="#Speechtags" />
      <salt:prompt id="Prompt1">
        You are traveling from 
        <salt:value targetelement="fromCity"  targetattribute="value"/>
        to 
        <salt:value targetelement="toCity"  targetattribute="value"/>
      </salt:prompt>

    <input type="button" name="BtnStart1" value="Start Prompt" OnClick="StartPlayback1()" id="Button1">

    <br><br>
    
    Click <b>Start Prompt</b> to begin speaking the prompt. The names of the <b>From</b>
    and <b>To</b> cities will be spoken. The cities names may be changed before starting the prompt.

    <br><br>
    From city: <input type="textbox" name="fromCity" value="Seattle" id="fromCity1">

    <br><br>
    To city: <input type="textbox" name="toCity" value="Houston" id="toCity1">

    <script language="JScript">
    <!--
      function StartPlayback1() {
        Prompt1.Start();
      }
    -->
    </script>
  </body>
</html>

See Also

prompt Element |  targetattribute Element | targetelement Attribute