- Joined
- Mar 19, 2008
- Posts
- 334
- Reaction score
- 2
Hopefully really easy for someone with even a basic understanding of javascript.
I've 'written'
a function which collects the info from a form field:
When i try to call the bugger later on
it comes back as undefined.
I know it works fine as if I move the document.write into the function it does the calculation (but in a new page?!?!?)
I thinkits something to do with global/local variables but after reading about 50 different tutorials its still not working.
Can anyone help?
Thanks
I've 'written'
var justhow;
function calculate(select)
{
justhow = document.forms[0].howmany.value;
}
When i try to call the bugger later on
document.write('<input type="text" name="total" size="10" value="' + justhow + '">');
it comes back as undefined.
I know it works fine as if I move the document.write into the function it does the calculation (but in a new page?!?!?)
I thinkits something to do with global/local variables but after reading about 50 different tutorials its still not working.
Can anyone help?
Thanks