Loading ...
Sorry, an error occurred while loading the content.

DOM Utility with Firefox

Expand Messages
  • ryan_newsome22
    I am currently using the DOM utility and the Calendar Control to receive Date information on a web form. The code below works great in IE, but is not
    Message 1 of 3 , Apr 30, 2007
    • 0 Attachment
      I am currently using the DOM utility and the Calendar Control to
      receive Date information on a web form. The code below works great
      in IE, but is not displaying the calendar popup in Firefox. Can
      anyone provide some insight on what the problem is, are there issues
      with the YUI and Mozilla?

      Thanks!!

      function showCal1() {

      var xy = YAHOO.util.Dom.getXY('SDate');
      var date = YAHOO.util.Dom.get('SDate').value;

      if (date) {
      YAHOO.srs.calendar.cal1.cfg.setProperty('selected', date);
      YAHOO.srs.calendar.cal1.cfg.setProperty('pagedate', new Date
      (date), true);
      YAHOO.srs.calendar.cal1.render();
      }

      YAHOO.util.Dom.setStyle('cal1Container', 'display', 'block');
      xy[1] = xy[1] + 20;
      YAHOO.util.Dom.setXY('cal1Container', xy);
      }
    • Satyen Desai
      Hi, It s likely that your sDate element has a name= sDate attribute, but does not have an id= sDate attribute. It maybe something like:
      Message 2 of 3 , Apr 30, 2007
      • 0 Attachment
        Hi,

        It's likely that your "sDate" element has a name="sDate" attribute,
        but does not have an id="sDate" attribute.

        It maybe something like:

        <input type="text" name="sDate" value="Apr 30, 2007" />

        Changing it to:

        <input type="text" name="sDate" id="sDate" value="Apr 30, 2007" />

        should fix the issue.

        DOM's get/getXY methods expect the String passed in to refer to the ID
        of the element you're interested in (and not the name).

        The reason that they work in IE with a name is because IE's
        implementation of getElementById, which DOM uses, looks up elements by
        both name and id and is not something which should be relied upon.

        In general, the link below defines and explains YUI's browser support
        in detail:

        http://developer.yahoo.com/yui/articles/gbs/index.html

        Hope that helps,
        Satyen
      • ryan_newsome22
        Hi Satyen, Thank you very much, you were right on!! Thanks, Ryan ... 2007 / ... the ID ... elements by ... support
        Message 3 of 3 , Apr 30, 2007
        • 0 Attachment
          Hi Satyen,

          Thank you very much, you were right on!!

          Thanks,

          Ryan



          --- In ydn-javascript@yahoogroups.com, "Satyen Desai" <sdezzi@...>
          wrote:
          >
          > Hi,
          >
          > It's likely that your "sDate" element has a name="sDate" attribute,
          > but does not have an id="sDate" attribute.
          >
          > It maybe something like:
          >
          > <input type="text" name="sDate" value="Apr 30, 2007" />
          >
          > Changing it to:
          >
          > <input type="text" name="sDate" id="sDate" value="Apr 30,
          2007" />
          >
          > should fix the issue.
          >
          > DOM's get/getXY methods expect the String passed in to refer to
          the ID
          > of the element you're interested in (and not the name).
          >
          > The reason that they work in IE with a name is because IE's
          > implementation of getElementById, which DOM uses, looks up
          elements by
          > both name and id and is not something which should be relied upon.
          >
          > In general, the link below defines and explains YUI's browser
          support
          > in detail:
          >
          > http://developer.yahoo.com/yui/articles/gbs/index.html
          >
          > Hope that helps,
          > Satyen
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.