Image

Imagemuerte wrote in Imagewebdev

XHTML + Javascript?

In the past I've manipulated my HTML form elements using javascript. Something like:






document.form.input_box.value = "foo"





No big deal... Now I'm using XHTML 1.1 strict and I want do something similar, but the form tag isn't allowed to have a name any more. So I'm assuming it has to be done via ID fields? I can still give my form an ID, is there some way I can manipulate it this way? The only way I've figured out is to use getElementById, but that seems like overkill. Is there a better way to do this?






var eid=document.getElementByID('id');

eid.value = "foo";