JavaScript Program to Check Regular expression use of exec( ) method

Write a JavaScript program to check regular expression use of exec( ) method.

Source Code
    <title>Regular expression use of exec( ) method</title>
    function check()
        var txt = document.getElementById("txt").value
        var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/
        var res = regex.exec(txt)

        for(i=0; i<res.length; i++)
            document.getElementById("panel").innerHTML += res[i] + "<br/>"
<form name="myform">
    Enter text <input type="text" id="txt" /><br/>
    <input type="button" value="Submit" onclick="check()"/>
<p id='panel'></p>