You are here: Re: Text in textfield « HTML « IT news, forums, messages
Re: Text in textfield

Posted by Toby Inkster on 11/15/06 09:45

Willy wrote:

> <input name=userInput type=text value="something">
> Could value'something' ibe put in a variable via avascript?

Yes.

<form name=theForm>
<input name=userInput type=text value="">
</form>
<script type="text/javascript">
var myInput = document.forms["theForm"].elements["userInput"];
myInput.value = "something";
</script>

Note: I've given the form a name here. You don't need to -- you could
refer to it by number (the first form on the page is 'document.forms[0]',
the next one is 'document.forms[1]', etc), but numbers can accidentally
change when you rearrange your page next month.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация