Hi
I have a javascript:
<script language=”JavaScript”>
<!–
mycount=0;
function saySomething(){
mycount++;
myinput=document.forms[‘phpval’][‘ui’].value;
document.forms[‘phpval’][‘ui’].value=”;
document.all(‘ChatPane’).innerHTML += ‘<span id=”a’ + mycount + ‘”><font face=”Verdana, Arial, Helvetica, sans-serif” size=”1″><b><font color=”#006600″>Jij: </font></b><font color=”#006600″>’ + myinput + ‘</font></font><BR></span>’;
document.all(‘a’ + mycount).scrollIntoView(true);
jsrsExecute(“../jsrs.php”, myCallback, “replyjs”, Array(myinput));
}
function myCallback( returnstring ){
mycount++;
document.all(‘ChatPane’).innerHTML += ‘<span id=”a’ + mycount + ‘”><font face=”Verdana, Arial, Helvetica, sans-serif” size=”1″><b><font color=”#003366″>Marieke: </font></b><font color=”#003366″>’ + returnstring + ‘</font></font><BR></span>’;
document.all(‘a’ + mycount).scrollIntoView(true);
}
// –>
Yes it uses JSRS.
So from an input box a user types his or her message.
Hits “talk” and what was said is placed in the chatpane with the code + myinput +
The contents of myinput is also send to a another page (php) but that is besides the point.
the idea i have is to have “myinput” tested as a string that contains more than one word and or smiley code….
let’s say i have as input: ” Hi i feel 😉 “
the smiley code should be replaced with an image.
Problem is to catch myinput and make it analysed…
Something like:
var ScrnSize = “myinput”;
switch(ScrnSize) {
case “:-)”: document.write(‘<img border=”0″ src=”images_emo/angel.gif”>’);
}
Is useless for the myinput is taken as a whole…
Any one an example?
Thanks!