tæl antal tegn i indtastningsfelt i asp fejler
jeg har følgende kode som virker fint:<html>
<head>
<title>test</title>
<script language="JavaScript">
//Function to count the number of characters in the description text box
function DescriptionCharCount() {
document.frmSignGuestBook.countcharacters.value = document.frmSignGuestBook.comments.value.length;
}
// -->
</script>
</head>
<body bgcolor="#990000" text="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class="back" link="#990000" vlink="#990000" alink="#990000">
<form method=post name="frmSignGuestBook" action="add_comments.asp?PagePosition=<% = Server.URLEncode(Request.QueryString("PagePosition")) %>" onSubmit="return CheckForm();" onReset="return confirm('Are you sure you want to Clear the Form?');">
<table width="100%" border="1" align="center" height="233" bgcolor="#FFCC99" cellpadding="2" cellspacing="0" bordercolor="#990000">
<tr align="left">
<td width="76%" colspan="2" class="text"><textarea name="comments" cols="40" rows="6" onKeyDown="DescriptionCharCount();" onKeyUp="DescriptionCharCount();" class="onLoad11"></textarea>
</td>
</tr>
<tr>
<td valign="top" align="right" height="2" width="76%" class="text">Antal
tegn : </td>
<td height="2" width="76%"><input size="5" value="0" name="countcharacters" maxlength="5" class="onLoad11"></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
som sagt så virker den fint, men når jeg prøver at "integrere den et andet sted på mit site så fejler den.
Her er koden hvor den fejler, filen er stadig en ASP fil
den virker fint
if strBio = "1" then
Response.Write "<script language=""JavaScript"">"
Response.Write "//Function to count the number of characters in the description text box"
Response.Write "function DescriptionCharCount() {"
Response.Write " document.frmSignGuestBook.countcharacters.value = document.frmSignGuestBook.Bio.value.length;"
Response.Write "}"
Response.Write "// -->"
Response.Write "</script>"
Response.Write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""top"" align=""right"" nowrap width=""10%""><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>* Om mig: </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""top""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><textarea name=""Bio"" cols=""30"" rows=""4"" onKeyDown=""DescriptionCharCount();"" onKeyUp=""DescriptionCharCount();"" class=""onLoad11"">" & Trim(cleancode(strMyHobbies)) & "</textarea></font></td>" & vbNewLine & _
" </tr> <tr>"
Response.Write " <td valign=""top"" align=""right"" height=""2"" width=""76%"" class=""text"">Antal tegn : </td>"
Response.Write " <td height=""2"" width=""76%""><input size=""5"" value=""0"" name=""countcharacters"" maxlength=""5"" class=""onLoad11""></td>"
Response.Write " </tr>" & vbNewLine
end if
nogen der har en gylden løsning??
igen fordobler jeg hvis løsningen kommer idag :o)
hilsen
Duno
