Page 1 of 1
Textfileds
Posted: Wed Dec 11, 2002 12:59 am
by F.T.
How do insert text into an textfield that i have already declared, the text are to be inserted after an button has been pressed?
<input type="text" name="pnr" size="10" maxlength="15">
Posted: Wed Dec 11, 2002 1:20 am
by volka
You have to do it client-side e.g. via javascript
e.g.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>test html</title>
<script language="JavaScript" type="text/javascript">
function insertText(sId)
{
elem = document.getElementById(sId);
if(elem != null && elem.value!=null)
elem.value = elem.value + "....and more";
return true;
}
</script>
</head>
<body>
<input type="text" name="pnr" id="pnr" size="10" maxlength="15">
<button onClick="insertText('pnr')">insert</button>
</body></html>