document.getElementById(fieldName).value; is not working in chrome and firefox
<p>Following javascript in HTML is working in IE browser. But, when i execute in Chrome and Firefox browser is not working. </p>

<pre><code>var LastName = GetValueofField("txtName");

function GetValueofField(fieldName)
    {
        return document.getElementById(fieldName).value;
    }
</code></pre>

<p>please help me.</p>