AW: AW: AW: AW: [Javascript] Re: <select> focussieren

Laurent Muchacho LaurentM at london.virgin.net
Tue Feb 8 08:53:41 CST 2005


Hi

Just to make the things a bit clear as you went a bit the wrong way to find
your solution.
Putting the code after the form was the right approach.

1) You don't need to use getElementById as your in a form you can simply do
document.reparatur.art and this work in all browser as it is part of the
form document object.
2) to focus simply do document.reparatur.art.focus()
3) On the initial request I think our friend wanted to select one option as
well document.reparatur.art.selectedIndex = 2

Then the code should look a bit more like this 

>  <form action="" method="get" name="reparatur">
> 
>  <table width="100%">
>    <tr>
>      <td>
>        <select name="art" id="art">
>          <option value=""></option>
>          <option value="A">A</option>
>          <option value="D">D</option>
>          <option value="I">I</option>
>          <option value="L">L</option>
>          <option value="T" selected>T</option>
>          <option value="Text">Text</option>
>          <option value="F">F</option>
>        </select>
>      </td>
>    </tr>
>  </table>
>  </form>
>  <script language="JavaScript" type="text/javascript">
>      document.reparatur.art.focus();
	document.reparatur.art.selectedIndex = 2
>  </script>

A few link to simple tutorial 
http://www.w3schools.com/htmldom/dom_obj_form.asp

>From this page you will get a really good tutorial to learn everything
javascript dhtml related download any of the zip or view the pdf however
this tutorial is a bit old and the technology in use need to be adapt to new
browser but the way it describe thing it's just amazing.
http://ftp.iasi.rdsnet.ro/mirrors/ftp.dansteinman.com/dynduo/

Laurent

-----Original Message-----
From: Michael Borchers [mailto:borchers at tridem.de]
Sent: 08 February 2005 13:53
To: [JavaScript List]
Subject: AW: AW: AW: AW: AW: [Javascript] Re: <select> focussieren


indeed , this works
thanks everbody!

> <html>
>  <head>
>  <title></title>
>  </head>
> 
>  <body>
> 
>  <form action="" method="get" name="reparatur">
> 
>  <table width="100%">
>    <tr>
>      <td>
>        <select name="art" id="art">
>          <option value=""></option>
>          <option value="A">A</option>
>          <option value="D">D</option>
>          <option value="I">I</option>
>          <option value="L">L</option>
>          <option value="T" selected>T</option>
>          <option value="Text">Text</option>
>          <option value="F">F</option>
>        </select>
>      </td>
>    </tr>
>  </table>
>  </form>
>  <script language="JavaScript" type="text/javascript">
>      document.getElementById("art").focus();
>  </script>
>  </body>
> </html>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list