Please fix this javascript. Its not getting form value
<pre><code>&lt;script type='text/javascript'&gt;
    dtoken=document.getElementsByName('d_token').value;
    document.write('The token is '+dtoken+'. Please write it down');
&lt;/script&gt;

&lt;form&gt;&lt;input type="hidden" name="d_token" value="x35GMwmtpaMtjh"/&gt;&lt;/form&gt;
</code></pre>

<p>I'm trying to get the value of the input field into the javascript. But now it look like 'The token is undefined. Please write it down'. I want the value of the input field name token into the javascript to display instead of undefined. Please fix it</p>
