×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

maybe this is what you want.

<script language="javascript">
function changeHints(){
var l=strlength(document.frmAnnounce.subject.value)
if (l<=100) {
if (document.all!=null)
document.all("hints").innerText="还可以输入"+(100-l)+"字节"
}
return true
}
</script>

<td width="60" nowrap >主题:</td>
<td nowrap ><input type="text" name="subject"
maxlength="255" size="40" value="" onKeyDown="return
changeHints()" onKeyUp="return changeHints()"> (<span
id="hints" color="red">还可以输入100字节</span>)</td>
Report

Replies, comments and Discussions:

  • 枫下沙龙 / 站务管理 / Sailer, Roller & Jabbour (sorry if I missed anyone), can you do a simple JavaScript, so that I..
    本文发表在 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
    • I think it's easy, but have no time to go through your code. Send me you phone number, we can have a talk.
    • rolia.com has similar function, please check the source code of this page:
      • I didn't make myself clear enough, I suggest an <INPUT> on Rolia, so that I can watch the number of characters WHILE I'm typing. It'd a little
        necessary if Rolia can fix the bug: with certain browser, after I was told that I had exceeded the number of the characters for title, I wouldn't be able to resent my post, because it said "Your message has already been posted"...
        • Thanks, I'll fix it.
        • maybe this is what you want.
          <script language="javascript">
          function changeHints(){
          var l=strlength(document.frmAnnounce.subject.value)
          if (l<=100) {
          if (document.all!=null)
          document.all("hints").innerText="还可以输入"+(100-l)+"字节"
          }
          return true
          }
          </script>

          <td width="60" nowrap >主题:</td>
          <td nowrap ><input type="text" name="subject"
          maxlength="255" size="40" value="" onKeyDown="return
          changeHints()" onKeyUp="return changeHints()"> (<span
          id="hints" color="red">还可以输入100字节</span>)</td>
          • Very nice! Thanks!!