Right now I'm trying out the following code, but nothing will appear in any of my input text boxes on page load.
HTML:
<body onload="test()">
<input type="text" id="line0"></input>
<br>
<input type="text" id='line1'></input>
<br>
<input type="text" id='line2'></input>
</body>
Javascript:
function test() {
var value = "test|some|thing";
var valueArray = value.split("|");
for (var lineNumber=0; lineNumber < valueArray.size(); lineNumber++)
{
line = "line" + lineNumber;
document.getElementById(line).value = valueArray[lineNumber];
}
}
JFiddle: http://jsfiddle.net/mWL9m/1/
In my actual code, I will be bringing in a value from outside the function, but that isn't really important. Right now I'm just using the test value value
.
I've looked at several different threads, but all seem to be focused on onclick
rather than onload
.