|
Using "SPEAK" interactively via HTML Camera Interface John Cabrer from United States [13 posts] |
16 year
|
I wrote a script to generate audio when the camera is moved via the web interface ("Down!", "Up!", etc...), and made some cosmetic and functional modifications to the index.html page to make it look friendlier, and support multiple presets.
Now I would like to add a text field that allows the person controlling the camera to type a message in a text field, press a button on the screen, and have that action result in a variable called SPEAK_MESSAGE that contains the message. I can then pipe this value into SPEAK, and hear what the controller wants to say (you have to clear the value at the end of the RR script, otherwise it will repeat over and over).
I could probably figure this out, but I'm not familiar at all with javascript forms. Any pointers would be greatly appreciated.
|
|
|
John Cabrer from United States [13 posts] |
16 year
|
Here is what I have been trying to do:
<tr>
<td align=center>
<input type="text" name="myMessage" value="">
<input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+[myMessage])">
</tr>
The problem is that [myMessage] is not seen as a variable (at least not one with a value), so the text that is spoket is "Object!".
|
|
|
John Cabrer from United States [13 posts] |
16 year
|
Ok. I got it!
<tr>
<td align=center>
<input type="text" name="myMessage" value="">
<input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+document.getElementById('myMessage').value)">
</tr>
|
|
|
John Cabrer from United States [13 posts] |
16 year
|
|
|
John Cabrer from United States [13 posts] |
16 year
|
Ooops! This method only works in Internet Explorer! Anybody know a better way to make this more widely compatible?
|
|
|
John Cabrer from United States [13 posts] |
16 year
|
<tr>
<td colspan=2 align=center>
<input type="text" id="myMessage" value="">
<input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+document.getElementById('myMessage').value)">
</td>
</tr>
Found that I needed to use "id=" instead of "name=", as FF and IE both understand "id=", but only IE understands "name="
|
|
|
Anonymous |
16 year
|
Yup, you got it. I just tried it in FF and it seems to work well. Hey, you even waved back! Cool!!
STeven.
|
|