www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to call a javascript function from click button in another javascript function?

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    How to call a javascript function from click button in another javascript function?

    <html>
    <head>
    <script type="text/javascript">

    function call()
    {
    design()
    }

    function design()
    {
    document.write("<center>")
    document.write("User Name:<input type='text'>"+'<br><br>')
    document.write("Password:<input type='text'>"+'<br><br><br>')
    document.write("<input type='button' value='Submit' onclick='javascript:ssubmit()'>")
    document.write("</center>")
    }

    function ssubmit()
    {
    document.write("Thank u For Your Registration")
    }

    </script>
    </head>
    <body>
    <a href="javascript:call()">Click Me</a>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2013
    Posts
    2
    I have tried this code and the function Design() click event that should call the ssubmit() function does nothing. Can any body help please?

  3. #3
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,391
    You cannot use document.write AFTER the page has been rendered.
    Doing so, will re-write the page to original conditions and reset your entry.

    note also that call() is a reserved word in javascript.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles