HTML works but javascript fails with href

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stockton
    New Member
    • Jul 2008
    • 6

    HTML works but javascript fails with href

    I have javascript as follows
    Code:
    function newDoc()
        {
        window.location.href = "http://192.168.0.8/devit/logon.html";
        }
    If I call this function from my javascript as follows
    Code:
            newDoc();
    it fails but if called from HTML
    Code:
    <input type="button" nanme="SelectButton" id="SelectButton" value="Login" onclick="newDoc()" height="50" />
    it works.
    Please tell me what I am getting wrong.
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    what does FF or Chrome's javascript-console report as error? that will give you a hint already. otherwise we would need to see more of the code - may be you call the function before its declared or similar.

    Comment

    Working...