本文发表在 rolia.net 枫下论坛the number of charaters are controlled before poster click the submit button? Something like this:
---
<html>
<head>
<script LANGUAGE="JavaScript">
<!--
okayToSendMessage=true;
function updateCharCount()
{
document.PCS_MESSAGE.CHARCOUNT.value = (document.PCS_MESSAGE.SENDER.value.length + document.PCS_MESSAGE.PAGETEXT1.value.length + 1 * document.PCS_MESSAGE.TIMETAG.options[document.PCS_MESSAGE.TIMETAG.selectedIndex].value);
return true;
}
function wait()
{
//Only allow the submit button to be pressed once!
if( okayToSendMessage == true )
{
okayToSendMessage=false;
return true;
}
else
{
return false;
}
}
//-->
function sendpage() {
if(0 != document.PCS_MESSAGE.TIMETAG.options[document.PCS_MESSAGE.TIMETAG.selectedIndex].value) {
dato=new Date();
date=dato.getDate();
hour=dato.getHours();
minute=dato.getMinutes();
document.PCS_MESSAGE.PAGETEXT1.value+=(" @"+date+"/"+hour+":"+minute);
}
// alert("@"+date+"/"+hour+":"+minute);
document.PCS_MESSAGE.submit();
}
</script>
<script LANGUAGE="JavaScript1.2">
<!--
// ------------------------------------------------------
// Detect for Navigator/IE and Dynamic HTML capabilities.
// ------------------------------------------------------
var isNS = (navigator.appName == "Netscape");
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isVERSION = (navigator.appVersion);
if (isNS && (parseInt(isVERSION) >= 4 ) )
{
document.captureEvents(Event.KEYUP);
document.onkeyup = updateCharCount;
}
if (isMSIE && (parseInt(isVERSION) >= 4 ) )
{
document.onkeyup = updateCharCount;
}
//-->
</script>
</head>
<body>
<font color=darkblue face="Arial,Helvetica">
<b><font size=+2 face="Times Roman">Page Charlie</font></b><p>
<form NAME="PCS_MESSAGE" METHOD="POST" ACTION="http://sabre.cantelatt.com/cgi-bin/sendpcs.cgi" onSubmit="return wait()" method=POST>
<input type="hidden" name="TEMPLATE"
value="/img/sms/general/outbox/messageConfirmation.html">
<input type="hidden"
name="AREA_CODE" value="416">
<input type="hidden" name="PIN1"
value="616">
<input type="hidden" name="PIN2" value="3465">
<b>your option:</b>
<br>
<select name=TIMETAG onchange='updateCharCount()'>
<option onselect='updateCharCount(); document.PCS_MESSAGE.PAGETEXT1.MAXLENTH=113' value=10>Time stamp the message
<option onselect='updateCharCount(); document.PCS_MESSAGE.PAGETEXT1.MAXLENTH=123' value=0>Maximize the message length
</select>
<!-- Step 1 Form Field -->
<P><b>your name: </b>
<br>
<input TYPE="TEXT" NAME="SENDER" SIZE="22"
MAXLENGTH="20" onChange="updateCharCount();">
<P>
<b>your message: </b>
<br>
<!-- Step 2 Form Field -->
<textarea NAME="PAGETEXT1" ROWS="4" COLS="31"
WRAP="VIRTUAL" MAXLENTH="113" onChange="updateCharCount();"></textarea>
<P>
<nobr>
number of characters:
<input TYPE="TEXT" NAME="CHARCOUNT" VALUE="10" SIZE="4">
<input type=button value="send" onclick='sendpage()'>
</nobr>
</form>
</font>
<p>
<img src="/cgi-bin/counter/3">
</body>
</html>
<!-- text below generated by server. PLEASE REMOVE --></object></layer></div></span></style></noscript></table></script></applet>
<script language="JavaScript">var PUpage="76001067"; var PUprop="geocities"; </script><script language="JavaScript" src="http://www.geocities.com/js_source/pu2geo.js"></script><script language="JavaScript" src="http://us.geocities.com/js_source/ygIELib9.js?v3"></script><script language="JavaScript">var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001067&l=NE&b=1&t=1003528174';yviR='us';yfiEA(0);</script><script language="JavaScript" src="http://us.geocities.com/js_source/geov2.js"></script><script language="javascript">geovisit();</script><noscript><img src="http://visit.geocities.com/visit.gif?1003528174" border=0 width=1 height=1></noscript>更多精彩文章及讨论,请光临枫下论坛 rolia.net
---
<html>
<head>
<script LANGUAGE="JavaScript">
<!--
okayToSendMessage=true;
function updateCharCount()
{
document.PCS_MESSAGE.CHARCOUNT.value = (document.PCS_MESSAGE.SENDER.value.length + document.PCS_MESSAGE.PAGETEXT1.value.length + 1 * document.PCS_MESSAGE.TIMETAG.options[document.PCS_MESSAGE.TIMETAG.selectedIndex].value);
return true;
}
function wait()
{
//Only allow the submit button to be pressed once!
if( okayToSendMessage == true )
{
okayToSendMessage=false;
return true;
}
else
{
return false;
}
}
//-->
function sendpage() {
if(0 != document.PCS_MESSAGE.TIMETAG.options[document.PCS_MESSAGE.TIMETAG.selectedIndex].value) {
dato=new Date();
date=dato.getDate();
hour=dato.getHours();
minute=dato.getMinutes();
document.PCS_MESSAGE.PAGETEXT1.value+=(" @"+date+"/"+hour+":"+minute);
}
// alert("@"+date+"/"+hour+":"+minute);
document.PCS_MESSAGE.submit();
}
</script>
<script LANGUAGE="JavaScript1.2">
<!--
// ------------------------------------------------------
// Detect for Navigator/IE and Dynamic HTML capabilities.
// ------------------------------------------------------
var isNS = (navigator.appName == "Netscape");
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isVERSION = (navigator.appVersion);
if (isNS && (parseInt(isVERSION) >= 4 ) )
{
document.captureEvents(Event.KEYUP);
document.onkeyup = updateCharCount;
}
if (isMSIE && (parseInt(isVERSION) >= 4 ) )
{
document.onkeyup = updateCharCount;
}
//-->
</script>
</head>
<body>
<font color=darkblue face="Arial,Helvetica">
<b><font size=+2 face="Times Roman">Page Charlie</font></b><p>
<form NAME="PCS_MESSAGE" METHOD="POST" ACTION="http://sabre.cantelatt.com/cgi-bin/sendpcs.cgi" onSubmit="return wait()" method=POST>
<input type="hidden" name="TEMPLATE"
value="/img/sms/general/outbox/messageConfirmation.html">
<input type="hidden"
name="AREA_CODE" value="416">
<input type="hidden" name="PIN1"
value="616">
<input type="hidden" name="PIN2" value="3465">
<b>your option:</b>
<br>
<select name=TIMETAG onchange='updateCharCount()'>
<option onselect='updateCharCount(); document.PCS_MESSAGE.PAGETEXT1.MAXLENTH=113' value=10>Time stamp the message
<option onselect='updateCharCount(); document.PCS_MESSAGE.PAGETEXT1.MAXLENTH=123' value=0>Maximize the message length
</select>
<!-- Step 1 Form Field -->
<P><b>your name: </b>
<br>
<input TYPE="TEXT" NAME="SENDER" SIZE="22"
MAXLENGTH="20" onChange="updateCharCount();">
<P>
<b>your message: </b>
<br>
<!-- Step 2 Form Field -->
<textarea NAME="PAGETEXT1" ROWS="4" COLS="31"
WRAP="VIRTUAL" MAXLENTH="113" onChange="updateCharCount();"></textarea>
<P>
<nobr>
number of characters:
<input TYPE="TEXT" NAME="CHARCOUNT" VALUE="10" SIZE="4">
<input type=button value="send" onclick='sendpage()'>
</nobr>
</form>
</font>
<p>
<img src="/cgi-bin/counter/3">
</body>
</html>
<!-- text below generated by server. PLEASE REMOVE --></object></layer></div></span></style></noscript></table></script></applet>
<script language="JavaScript">var PUpage="76001067"; var PUprop="geocities"; </script><script language="JavaScript" src="http://www.geocities.com/js_source/pu2geo.js"></script><script language="JavaScript" src="http://us.geocities.com/js_source/ygIELib9.js?v3"></script><script language="JavaScript">var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001067&l=NE&b=1&t=1003528174';yviR='us';yfiEA(0);</script><script language="JavaScript" src="http://us.geocities.com/js_source/geov2.js"></script><script language="javascript">geovisit();</script><noscript><img src="http://visit.geocities.com/visit.gif?1003528174" border=0 width=1 height=1></noscript>更多精彩文章及讨论,请光临枫下论坛 rolia.net