Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7588
| From | "Garry Jones" <garry@garryjones.se> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Clear field with Javascript - use of variable? |
| Date | 2011-10-21 00:27 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <j7q78d$mn7$1@dont-email.me> (permalink) |
I need to expand a function and a user button that clears an input field and
sets focus.
This works
<script language="JavaScript" type="text/javascript">
function cfld() {
document.getElementById("newsinl").value="";
document.getElementById("newsinl").focus();
}
</script>
<input maxLength="100" name="newsinl" id="newsinl" type="text" value=""
size="100">
<a href="javascript:cfld();" >Clear field</a>
What I need to do is to have several more of these functions.
Instead of writing a seperate function for each input field I would like to
use the same one and pass a variable from each link. Can someone point me in
the right direction as I am having problems finding a good site with simple
instructions for this.
Any help appreciated
Garry Jone
Expat, Sweden
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar
Clear field with Javascript - use of variable? "Garry Jones" <garry@garryjones.se> - 2011-10-21 00:27 +0200
Re: Clear field with Javascript - use of variable? Tim Streater <timstreater@greenbee.net> - 2011-10-20 23:53 +0100
Re: Clear field with Javascript - use of variable? Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-10-21 11:24 +0200
Re: Clear field with Javascript - use of variable? Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-21 21:53 +0100
Re: Clear field with Javascript - use of variable? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 01:17 +0200
csiph-web