hi everyone i have 2 textboxes: when i enter a name on first textbox the first letter of what i have entered will appear on second textbox...is it possible for javascript?

to make it clear:
i will enter a name "COCOMARTIN" on the firstbox and the first letter " C " will appear on second textbox..

can someone help me on this ... :)

Recommended Answers

All 3 Replies

Hopes this may help you

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function name_dis()
{
var str=document.f.t1.value;
var lett=str.charAt(0);
document.f.t2.value=lett;
 
}
</script>
</head>

<body>
<form id="form1" name="f" method="post" action="">
  <label>
  <input type="text" name="t1" id="t1" onkeyup="name_dis()"/>
  </label>
  <p>
    <label>
    <input type="text" name="t2" id="t2" />
    </label>
  </p>
</form>
</body>
</html>

thankzz for the info dude ^^ ur the best....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.