A Tutorial Introduction to SALT3. A First Web Page3.1 A SALT version of the "Hello World!" programA tradition in computer programming is to introduce a new programming language by describing a program that does nothing but say 'Hello'. In that tradition you will see a SALT program below that when run within Internet Explorer with the Speech Add-in installed will speak "Hello World"!
If you have the Speech add-in installed, you can try this out on your computer: Normal version, Debug version. Let's look at this, line by line.
3.2 Internet Explorer securityIf you open this file in Internet Explorer and get the warning message below, this is because security settings do not automatically allow the use of Active-X controls on web pages. ![]() You can either click on the yellow 'Information Bar' and choose 'Allow Blocked Content', or you can change the default security settings to allow all active objects loaded from pages on your computer to run without the warning. To do this choose Tools/Internet Options, then select the Advanced tab and scroll down to the Security section. Then check the option "Allow active content to run in files on my computer": ![]() This lets the speech add-in to run without the warning provided that it is properly installed on your computer. 3.3 Simple variationA simple variation on the 'Hello World' program allows us to speak text entered by the user into an input field. In the page below, we connect a button to a Javascript function which retrieves the contents of an input text field and passes it to the Start() method of a SALT prompt object. Try this out on your computer: Normal version, Debug version.
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
<object id="speech-add-in" CLASSID="clsid:33cbfc53-a7de-491a-90f3-0e782a7e347a">
</object>
<?import namespace="salt" implementation="#speech-add-in"/>
<salt:prompt id="prompter"></salt:prompt>
<body>
<h2>SALT: Speak Field Contents</h2>
<input type="text" id="iptext" name="iptext" value="Type some text here" size="40">
<input type="button" name="speak" value="Speak" onClick="dospeak()">
</body>
<script>
function dospeak()
{
var pfield=document.getElementById("iptext");
var pprompt=document.getElementById("prompter");
pprompt.Start(pfield.value);
}
</script>
</html>
The changes we have made are:
This is what it should look like. Type in some text and click on Speak to hear the computer say it. ![]() Next: speech recognition.
|
|
University College London - Gower Street - London - WC1E 6BT - |