Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-09-2006, 11:14 PM   #1 (permalink)
 
Newb Techie

Join Date: Mar 2006

Posts: 2

silapa

Default HTML Question

How can i make it so when I type in the a input box it will fill the input box not continue across?
silapa is offline  
Old 03-10-2006, 09:42 AM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

http://javascript.internet.com/forms...r-counter.html

Use this script to limit the number of characters allowed in an input box. It will count the number of characters left in the box and display it below. Easy to modify.


<!-- TWO STEPS TO INSTALL CHARACTER COUNTER:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->



<HEAD>

<script type="text/javascript">




<!--
function getObject(obj) {
var theObj;
if(document.all) {
if(typeof obj=="string") {
return document.all(obj);
} else {
return obj.style;
}
}
if(document.getElementById) {
if(typeof obj=="string") {
return document.getElementById(obj);
} else {
return obj.style;
}
}
return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
var entradaObj=getObject(entrada);
var salidaObj=getObject(salida);
var longitud=caracteres - entradaObj.value.length;
if(longitud <= 0) {
longitud=0;
texto='<span class="disable"> '+texto+' </span>';
entradaObj.value=entradaObj.value.substr(0,caracte res);
}
salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}

//-->
</script>


<style type="text/css">
<!--
BODY {
font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: Black;
margin-left: 0px;
margin-right: 0px;
background-color: White;
}

.minitext {
font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;
font-size: 8pt;
font-weight: normal;
color: Black;
}

.0 {
background-color: #4786D2;
}
.1 {
background-color: #D3E8FD;
}
.2 {
background-color: #D3E8FD;
}
.3 {
background-color: #D3E8FD;
}
.4 {
background-color: #D3E8FD;
}

TABLE {
font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: Black;
}

INPUT.text {
background-color: #FFFFFF;
color: Black;
border: 2px ridge Black;
font-size: 10px;
font-family: Verdana, Arial;
font-weight: normal;
}

.enable {
background-color: #77FF77;
font-weight: bold;
color: Black;
}
.disable {
background-color: #FF7777;
font-weight: bold;
color: Black;
}
-->
</style>

</HEAD>



<BODY>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<form action="#" method="post">
<table align="center" class="0" border="0" cellspacing="1" cellpadding="5">
<tr>
<td align="right" class="1"><span class="options">Field Name</span></td>
<td class="2"><INPUT TYPE="TEXT" class="text" id="eBann" name="bannerURL" maxlength="100" size="60" onKeyUp="Contar('eBann','sBann','{CHAR} characters left.',100);">
<span id="sBann" class="minitext">100 characters left.</span></td>
</tr>
</table>
</form>




<center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided

by The JavaScript Source</font>
</center>




office politics is offline  
Old 03-12-2006, 07:29 AM   #3 (permalink)
 
Newb Techie

Join Date: Mar 2006

Posts: 2

silapa

Default

i want it to be like in Yahoo messenger


silapa is offline  
Old 03-12-2006, 10:16 PM   #4 (permalink)
 
Junior Techie

Join Date: Oct 2005

Posts: 75

darkninja

Default

use a textbox

eg :

<textarea name="MYVARIABLE" wrap=""></textarea>

in wrap="" you can chose hard, soft or off

Hope that helps!
__________________
<a href="http://www.flashyflashy.net" target="_blank">flashyflashy.net</a>
darkninja is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On