online tutorials, website development, web application development

  Powered by Leger Solutions

Javascript Tutorials

Submit is not a function

This means you have a function trying to call the form's submit() method, but you also have a button which is called submit(). This causes a conflict in javascript, because the submit method is already bound to that button.

To solve the problem, simply change the name of the button so that name="moo" (or something). Your submit() call in your javascript function/method will now work.


Change type="Text" to type="Password"

<html>
<head>
<script language="javascript" type="text/javascript">
function passit(obj, oType){
    var newO=document.createElement('input');
    newO.setAttribute('type', oType);
    newO.setAttribute('name',obj.getAttribute('name'));
    newO.setAttribute('id',obj.getAttribute('id'));
    newO.size = obj.size;
    newO.className = obj.className;
    newO.onFocus = obj.onFocus;
    newO.value = obj.value;
    obj.parentNode.replaceChild(newO,obj);
    newO.focus();
}
</script>
</head>
<body>
    <input id="test" type="text">
    <a href="javascript:passit(document.getElementById('test'),'password');">
        Pword It
    </a>
    <a href="javascript:passit(document.getElementById('test'),'text');">Text</a>
</body>
</html>