[ILUG] Using JS to set a default Value for an HTML field element?
Greg McRandal
mcrandal at maths.tcd.ie
Thu Feb 23 17:47:47 GMT 2006
Hi,
This is how I'd do it:
<html>
<head>
<script>
function set_value_function() {
document.getElementById('input_id').value = 'some other value';
}
</script>
</head>
<body onload="set_value_function()">
<input type="textarea" id="input_id" />
</body>
</html>
Greg
>Hi all,
>
>Is it somehow possible to do the following:
>
><input type="textarea" value="Javascript:set_value_function()">
>
>?
>
>Obviously, the above doesn't work (or seem to, at any rate) but is there a way
>to set a textarea value or defaultValue to something other than a static string?
>
>Thanks,
>
>Braun Brelin
More information about the ILUG
mailing list