Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12496
| Date | 2012-03-08 16:04 +0100 |
|---|---|
| From | Martin Honnen <mahotrash@yahoo.de> |
| Organization | Liberty Development |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Super basic newbie question |
| References | <aaa3f536-d041-47fd-9c0c-2b158d5b82ee@x7g2000pbi.googlegroups.com> |
| Message-ID | <4f58ca7e$0$6567$9b4e6d93@newsspool3.arcor-online.net> (permalink) |
Larry.Martell@gmail.com wrote:
> Just getting started in javascript. This is my very first script.
>
> I have a very simple web page with a text entry field:
>
> <input type="text" id='filterValue" size=20>
>
> In my javascript function I want to get each keystroke from that
> field, and write it out. So I have:
>
> window.onload = function() {
> document.getElementById("filterValue").onkeypress = function() {
> var val = document.getElementById("filterValue").value;
> document.write("<p>" + val +"</p>");
Forget about document.write unless you want to use it during page load
or unless you want to completely overwrite the loaded page after page load.
After page load, to create new nodes and insert them use e.g
var p = document.createElement('p');
p.appendChild(document.createTextNode(val));
document.body.appendChild(p);
where obviously document.body is meant as an example, you can instead
select some other target parent element for the newly created 'p'
element and appendChild it there.
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Super basic newbie question "Larry.Martell@gmail.com" <larry.martell@gmail.com> - 2012-03-08 06:51 -0800
Re: Super basic newbie question Martin Honnen <mahotrash@yahoo.de> - 2012-03-08 16:04 +0100
Re: Super basic newbie question "Larry.Martell@gmail.com" <larry.martell@gmail.com> - 2012-03-08 09:15 -0800
Re: Super basic newbie question Mike Duffy <never@you.mind.com> - 2012-03-09 01:01 +0000
Re: Super basic newbie question "Tom de Neef" <tdeneef@qolor.nl> - 2012-03-08 16:08 +0100
Re: Super basic newbie question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-09 04:05 +0100
Re: Super basic newbie question "Tom de Neef" <tdeneef@qolor.nl> - 2012-03-09 10:47 +0100
Re: Super basic newbie question SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-08 16:10 +0100
Re: Super basic newbie question "Larry.Martell@gmail.com" <larry.martell@gmail.com> - 2012-03-08 09:15 -0800
Re: Super basic newbie question Dr J R Stockton <reply1210@merlyn.demon.co.uk> - 2012-03-09 21:39 +0000
Re: Super basic newbie question SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-10 09:55 +0100
Re: Super basic newbie question Swifty <steve.j.swift@gmail.com> - 2012-03-10 18:19 +0000
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-10 21:59 +0000
Re: Super basic newbie question Swifty <steve.j.swift@gmail.com> - 2012-03-12 09:58 +0000
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-12 10:02 +0000
Re: Super basic newbie question Swifty <steve.j.swift@gmail.com> - 2012-03-12 10:57 +0000
Re: Super basic newbie question John G Harris <john@nospam.demon.co.uk> - 2012-03-12 15:39 +0000
Re: Super basic newbie question John G Harris <john@nospam.demon.co.uk> - 2012-03-12 15:37 +0000
Re: Super basic newbie question Swifty <steve.j.swift@gmail.com> - 2012-03-13 10:34 +0000
Re: Super basic newbie question "Mel Smith" <med_cutout_syntel@aol.com> - 2012-03-13 10:12 -0600
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-13 19:44 +0000
Re: Super basic newbie question Gene Wirchenko <genew@ocis.net> - 2012-03-13 19:50 -0700
Re: Super basic newbie question Gene Wirchenko <genew@ocis.net> - 2012-03-13 08:58 -0700
Re: Super basic newbie question SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-11 00:04 +0100
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-10 23:16 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-12 16:41 -0700
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-13 19:46 +0000
Re: Super basic newbie question Dr J R Stockton <reply1211@merlyn.demon.co.uk.not.invalid> - 2012-03-14 21:01 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-14 17:18 -0700
Re: Super basic newbie question John G Harris <john@nospam.demon.co.uk> - 2012-03-15 20:16 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-15 14:36 -0700
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-15 23:41 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-15 16:49 -0700
Re: Super basic newbie question John G Harris <john@nospam.demon.co.uk> - 2012-03-16 16:55 +0000
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-16 18:09 +0000
Re: Super basic newbie question Dr J R Stockton <reply1211@merlyn.demon.co.uk.not.invalid> - 2012-03-16 19:47 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 18:27 -0700
Re: Super basic newbie question Dr J R Stockton <reply1211@merlyn.demon.co.uk.not.invalid> - 2012-03-18 19:27 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-18 16:55 -0700
Re: Super basic newbie question Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-03-17 11:35 +0100
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 09:42 -0700
Re: Super basic newbie question Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-03-18 01:33 +0100
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 17:46 -0700
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 19:45 -0700
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-15 10:00 +0000
Re: Super basic newbie question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 14:53 +0100
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 12:43 -0700
Re: Super basic newbie question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 23:39 +0100
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 15:54 -0700
Re: Super basic newbie question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-18 10:48 +0100
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-18 04:06 -0700
Re: Super basic newbie question Tim Streater <timstreater@greenbee.net> - 2012-03-18 13:52 +0000
Re: Super basic newbie question David Mark <dmark.cinsoft@gmail.com> - 2012-03-18 12:10 -0700
Re: Super basic newbie question Dr J R Stockton <reply1210@merlyn.demon.co.uk> - 2012-03-11 19:02 +0000
Re: Super basic newbie question "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-03-08 17:17 +0200
Re: Super basic newbie question "Larry.Martell@gmail.com" <larry.martell@gmail.com> - 2012-03-08 09:17 -0800
Re: Super basic newbie question Gene Wirchenko <genew@ocis.net> - 2012-03-08 08:44 -0800
Re: Super basic newbie question "Larry.Martell@gmail.com" <larry.martell@gmail.com> - 2012-03-08 09:24 -0800
Re: Super basic newbie question Denis McMahon <denismfmcmahon@gmail.com> - 2012-03-08 17:03 +0000
csiph-web