List Info

Thread: Can anybody Help me with some Javascript please




Can anybody Help me with some Javascript please
country flaguser name
United States
2007-06-04 08:22:46
as HTML TEXTAREA does not allow put a MAXLENGTH on a field I
have been
trying to use Javascript to overcome this problem. Now I am
fully
aware the following coding is in no way elegant; But I need
to know
how accomplish my objective and there after I can format
it)

I would be most grateful for any help - The invoice address
and
delivery address are not working but the delivery
instructions is. and
instead of coding it each time (pre OO days) how do I call a
function
and in this case would a common function works as I want to
capture
that data.

Please help me what am I doing wrong??

Thanks in advance
=============

<form action FX.HTM" method="POST">

<table>
		<tr bgcolor="cccccc">
			<td width="150">DESCRIPTION</td>
			<td width="400">T E S T -- I N F O R M A
T I O N</td>
		</tr>
<!
------------------------------------------------------------
---------------.>
		<tr>
			<td>CUSTOMER:</td>
			<td align="left">
				<input type=text" name="Customer"
size="40"
				 maxlength="35" />
			</td>
   		</tr>
<!
------------------------------------------------------------
---------------.>
		<tr>
			<td>COMPANY:</td>
			<td align="left">
				<input type=text" name="Company"
size="60"
				 maxlength="50" />
			</td>
   		 </tr>
 </table>
<! ---------------- INVOICE ADDRESS
------------------------------------------------------------

<table>
</form>
<FORM
	align="right"
	action="nextpage.asp"
	method=POST
	name="myForm0">
INVOICE ADDRESS:
<TEXTAREA
	rows=3 cols=40
	name="txt_project_description">
</TEXTAREA>
<BR>
<FONT
	size="3"
	>Max 80; characters:
       <input
	value="80"
	size="3"
	name="msgCL"
	disabled>
</FONT>
      <script language=
	"JavaScript">
<!--
       var supportsKeys = false
	function tick() {
	calcCharLeft(document.forms[0])
 if (!supportsKeys) timerID =
setTimeout("tick()",10)
}

function
	calcCharLeft(sig) {
 	clipped = false
	 maxLength = 80
 if (document.myForm0.txt_project_description.value.length
>
maxLength)
   {
   document.myForm0.txt_project_description.value =
document.myForm0.txt_project_description.value.substring(0,m
axLength)
   charleft = 0
   clipped = true
   }
 else
   {
   charleft = maxLength -
document.myForm0.txt_project_description.value.length
   }
   document.myForm0.msgCL.value = charleft
   return clipped
 }

tick();
//-->
</script>
<br>
</tr><br>
</table>


<! ---------------- DELIVERY ADDRESS
------------------------------------------------------------

<table>
</form>
<FORM
	align="right"
	action="nextpage.asp"
	method=POST
	name="myForm1">
DELIVER ADDRESS:
<TEXTAREA
	rows=3 cols=40
	name="txt_project_description">
</TEXTAREA>
<BR>
<FONT
	size="3"
	>Max 80 characters:
       <input
	value="80"
	size="3"
	name="msgCL"
	disabled>
</FONT>
      <script language=
	"JavaScript">
<!--
       var supportsKeys = false
	function tick() {
	calcCharLeft(document.forms[0])
 if (!supportsKeys) timerID =
setTimeout("tick()",10)
}

function
	calcCharLeft(sig) {
 	clipped = false
	 maxLength = 80
 if (document.myForm1.txt_project_description.value.length
>
maxLength)
   {
   document.myForm1.txt_project_description.value =
document.myForm1.txt_project_description.value.substring(0,m
axLength)
   charleft = 0
   clipped = true
   }
 else
   {
   charleft = maxLength -
document.myForm1.txt_project_description.value.length
   }
   document.myForm1.msgCL.value = charleft
   return clipped
 }

tick();
//-->
</script>
<br>
</tr><br>
</table>

<! ---------------- DELIVERY INSTRUCTIONS
------------------------------------------------------------

<table>
</form>
<FORM
	align="right"
	action="nextpage.asp"
	method=POST
	name="myForm2">
DELIVER INSTRUCTIONS:
<TEXTAREA
	rows=3 cols=40
	name="txt_project_description">
</TEXTAREA>
<BR>
<FONT
	size="3"
	>Max 80 characters:
       <input
	value="80"
	size="3"
	name="msgCL"
	disabled>
</FONT>
      <script language=
	"JavaScript">
<!--
       var supportsKeys = false
	function tick() {
	calcCharLeft(document.forms[0])
 if (!supportsKeys) timerID =
setTimeout("tick()",10)
}

function
	calcCharLeft(sig) {
 	clipped = false
	 maxLength = 80
 if (document.myForm2.txt_project_description.value.length
>
maxLength)
   {
   document.myForm2.txt_project_description.value =
document.myForm2.txt_project_description.value.substring(0,m
axLength)
   charleft = 0
   clipped = true
   }
 else
   {
   charleft = maxLength -
document.myForm2.txt_project_description.value.length
   }
   document.myForm2.msgCL.value = charleft
   return clipped
 }

tick();
//-->
</script>
<br>
</tr><br>
</table>

<html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )