Jacob Valenta
Jacob Valenta

Reputation: 6769

Reading inputs from HTML forms

When I found that I could clear a search box like this:

<input type='text' name='search' value='Search Here' onfocus='if (this.value == "Search Here")this.value = ""' />

It brought up two questions.

1) what language is this in? Are if statments built with HTML or javascript?

2) is there a way for a text input to mirror the value of another? (maybe value='id.value';)

Upvotes: 1

Views: 69

Answers (2)

Khez
Khez

Reputation: 10350

That language is called drums javascript. If you don't know, I'd suggest you take a look at jQuery, a javascript library that simplifies a bunch of tasks.

You can do many other things not just mirror values. You can add new elements, move old elements, get off-page data.

What can I say? Welcome to web development.

Upvotes: 0

tcooc
tcooc

Reputation: 21209

The language you are seeing is inline javascript, considered deprecated. It is better to have the handler inside a script.

If you need a refresher on javascript, see: https://developer.mozilla.org/en/A_re-introduction_to_JavaScript

Upvotes: 3

Related Questions