Javascript not executing

I’m working on an HTML page that has several forms that show up alternatively. When the page first loads the “Cash” form appears. It has the following date Javascript and it works fine:

<script type="text/javascript">
  DateInput('date1', true, 'yyyy-mm-dd')
</script>
<noscript>
  <label class="form" for="datem"><span>Date (m-d-y)</span></label>
    <input type="text" name="datem" id="datem" value="" size="2" maxlength="2" placeholder="MM" tabindex="3"> 
    <input type="text" name="dated" id="dated" value="" size="2" maxlength="2" placeholder="DD" tabindex="4"> 
    <input type="text" name="datey" id="datey" value="" size="4" maxlength="4" placeholder="YYYY" tabindex="5">
    <br>
</noscript>

To change forms I have four buttons that call a Javascript function [onClick=“getForm(‘stocks’)”] which gets the requested form from the server (AJAX style). That works fine too except the date Javascript shown above does not execute. I checked with Safari’s “Web Inspector” and the code did get to the browser.

How do I get Javascript to execute it?

Thanks for your help.

I found the answer! Right after the line that loads the form, tell Javascript to execute the required scripts

document.getElementById('form').innerHTML=xmlHttp.responseText;
// tell Javascript to execute the required scripts 
alert("kilroy was here");