SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    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:
    Code:
    <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.
    Denny Schlesinger
    web services

  2. #2
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I found the answer! Right after the line that loads the form, tell Javascript to execute the required scripts

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


Bookmarks

Posting Permissions

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