Hmmm, well thanks for the tip. I wondered if Iframe might be worth a
shot. Unfortunately, it didn't work. Here's my latest code (ASP
followed by updated Javascript, changes highlighted in red):
----------------------------------------------------------
Response.Write("<iframe id="""&obj_ID&"_editBox""
src="""&GetURL("template.asp")&""" FrameBorder=""0""
class=""CuteEditorFrame""
style=""border-color:#C0C0C0;border-width:1px;border-style:Solid;height:100%;width:100%;""
onKeyDown=""checkLength();""></iframe>")
Response.Write("<TEXTAREA name="""&ID&"""
rows="""&s_textareaRows&""" cols="""&s_textareaCols&"""
style=""DISPLAY: none; WIDTH: 100%; HEIGHT: 100%; valign: top""
ID="""&ID&""">" & Server.HTMLEncode( s_Text ) &
"</TEXTAREA>")
---------------------------------------------
<SCRIPT LANGUAGE="JavaScript">
function checkLength() {
var maxLength = 20;
var stripped = document.getElementById('Resume1').innerText;
var diff = stripped.length - maxLength;
if (diff > 0) {
alert('The maximum length for
this statement is ' + maxLength + ' characters (roughly 5 pages). Your
entry exceeds that length by ' + diff + '.');
this.focus();
}
}
</SCRIPT>
---------------------------------------------
For good measure, I tried the var = stripped line exactly as you
provided. That also did not work. I also tried hard-coding the
maxlength for now, just until I can get it working.
The issue is that the checkLength function is never getting called.
I've put alerts all over the place for testing (excluded here) and I
can say with confidence that I'm never getting inside the checkLength
function, whether it's called from the textarea in an onblur, from the
form in an onsubmit or onunload, or from the iframe in an onkeydown.
Any other ideas?
Thanks,
Jess