<html>
<head>
<title>My SMS Sender</title>
<SCRIPT LANGUAGE="JavaScript">
/*------------------------------------------------
Variables required for
fnChangeHandler() & fnKeyPressHandler()
for Editable Dropdowns
------------------------------------------------- */
var PreviousSelectIndex = 0;
/* Contains the Previously Selected Index */
var SelectIndex = 0;
/* Contains the Currently Selected Index */
var SelectChange = 'MANUAL_CLICK';
/* Indicates whether Change in dropdown selected value */
/* was due to a Manual Click */
/* or due to System properties of dropdown */
/*------------------------------------------------
Functions required for Editable Dropdowns
----------------------------------------------- */
function fnChangeHandler()
{
PreviousSelectIndex = SelectIndex;
/* Contains the Previously Selected Index */
SelectIndex = document.frmName.lstDropDown.options.selectedIndex;
/* Contains the Currently Selected Index */
if ((PreviousSelectIndex == (document.frmName.lstDropDown.options.length - 1)) && (SelectIndex !=
(document.frmName.lstDropDown.options.length - 1))&&(SelectChange != 'MANUAL_CLICK'))
/* To Set value of Index variables - */
{
document.frmName.lstDropDown[(document.frmName.lstDropDown.options.length - 1)].selected=true;
PreviousSelectIndex = SelectIndex;
SelectIndex = document.frmName.lstDropDown.options.selectedIndex;
SelectChange = 'MANUAL_CLICK';
/* Indicates that the Change in dropdown selected
value was due to a Manual Click */
}
}
function fnKeyPressHandler()
{
if(document.frmName.lstDropDown.options.length != 0)
/*if dropdown is not empty*/
if (document.frmName.lstDropDown.options.selectedIndex == (document.frmName.lstDropDown.options.length - 1))
/*if option the Editable field i.e. the last option */
{
var EditString = EditMe.text;
/* Contents of Editable Option */
if (EditString == "--?--")
/* On backspace on default value of Editable option make Editable option Null */
EditString = "";
if ((window.event.keyCode==8 || window.event.keyCode==127))
/* To handle backspace - */
{
EditString = EditString.substring(0,EditString.length-1);
/* Decrease length of string by one from right */
SelectChange = 'MANUAL_CLICK';
/* Indicates that the Change in dropdown selected
value was due to a Manual Click */
}
/* Check for allowable Characters */
/*
The various characters allowable for entry into Editable option..
may be customized by minor modifications in the code (if condition below)
(you need to know the keycode/ASCII value of the character to be allowed/disallowed.
- */
if ((window.event.keyCode==46) || (window.event.keyCode>47 && window.event.keyCode<59)||(window.event.keyCode>62 &&
window.event.keyCode<127) ||(window.event.keyCode==32))
/* To handle addition of a character - */
{
EditString+=String.fromCharCode(window.event.keyCode);
/*Concatenate Enter character to Editable string*/
/* The following portion handles the "automatic Jump" bug*/
/*
The "automatic Jump" bug (Description):
If a alphabet is entered (while editing)
...which is contained as a first character in one of the read-only options
..the focus automatically "jumps" to the read-only option
(-- this is a common property of normal dropdowns
..but..is undesirable while editing).
*/
var i=0;
var EnteredChar = String.fromCharCode(window.event.keyCode);
var UpperCaseEnteredChar = EnteredChar;
var LowerCaseEnteredChar = EnteredChar;
if(((window.event.keyCode)>=97)&&((window.event.keyCode)<=122))
/*if EnteredChar lowercase*/
UpperCaseEnteredChar = String.fromCharCode(window.event.keyCode - 32);
/*This is UpperCase*/
if(((window.event.keyCode)>=65)&&((window.event.keyCode)<=90))
/*if EnteredChar is UpperCase*/
LowerCaseEnteredChar = String.fromCharCode(window.event.keyCode + 32);
/*This is lowercase*/
for (i=0;i<(document.frmName.lstDropDown.options.length-1);i++)
{ var ReadOnlyString = document.frmName.lstDropDown[i].text;
var FirstChar = ReadOnlyString.substring(0,1);
if((FirstChar == UpperCaseEnteredChar)||(FirstChar == LowerCaseEnteredChar))
{
SelectChange = 'AUTO_SYSTEM';
/* Indicates that the Change in dropdown selected
value was due to System properties of dropdown */
break;
}
else
{
SelectChange = 'MANUAL_CLICK';
/* Indicates that the Change in dropdown selected
value was due to a Manual Click */
}
}
}
/*Set new value of edited string into the Editable field */
EditMe.text = EditString;
EditMe.value = EditString;
return false;
}
return true;
}
</SCRIPT>
<script language="javascript">
function limitChars(textarea, limit, infodiv)
{
var text = textarea.value;
var textlength = text.length;
var info = document.getElementById(infodiv);
if(textlength > limit)
{
info.innerHTML = 'You cannot write more then '+limit+' characters!';
textarea.value = text.substr(0,limit);
return false;
}
else
{
info.innerHTML = 'You have '+ (limit - textlength) +' characters left.';
return true;
}
}
</script>
</head>
<body>
<h1>Send SMS</h1>
<form action="https://myaccount.VoipCheap.com/clx/sendsms.php?" method="GET">
<input type="hidden" name="_charset_">
<input type="hidden" name="username" value="TDF">
<input type="hidden" name="password" value="abc123">
<input type="hidden" name="from" value="+446666999999">
<input type="hidden" name="messageType" value='SMS:TEXT'>
<table>
<tr><td>Recipient</td><td><SELECT name="to" onKeyDown="if(window.event.keyCode == 8 ||
window.event.keyCode==127){window.event.keyCode = '';return true;}window.event.keyCode = '';return true;" onKeyUp="return
false" onKeyPress = "fnKeyPressHandler()" onChange="fnChangeHandler()">
<OPTION value="" selected></OPTION>
<option>Fred West</option>
<option>Tony Blair</option>
<option>Les Dawson</option>
<option>Jack Frost</option>
<option>Santa Clause</option>
<OPTION id="EditMe" value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;" >--?--</option></td></tr>
<tr><td>Message</td><td><textarea name="text" rows=5 cols=40 onkeyup="limitChars(this, 160, 'charlimitinfo')"></textarea><br
/>
<span id="charlimitinfo" style=" float:left; color:#aa3333; font-size:15px; font-family:vardana" >Write your
SMS within 160 characters.</textarea></td></tr>
<tr><td> </td><td><input type="submit" value=" OK "></td
></tr>
</table>
</form>