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

Re: [ydn-javascript] ID => e.target.id (Gecko Engine) - window.event.srcElement.id (Trident Engine)

Expand Messages
  • Eric Miraglia
    Orlando, A solution to the problem of getting the date-cell s dom element (and/ or that cell s id) is documented here:
    Message 1 of 7 , May 10, 2006
      Orlando,

      A solution to the problem of getting the date-cell's dom element (and/or that cell's id) is documented here:


      Good luck with your project!

      Regards,
      Eric


      On May 10, 2006, at 12:14 PM, o_j_p_p wrote:

      Hello everyone,

      I am trying to get the id for a yahoo object through a set_date()
      function set as its onSelect event handler.

      Here is the code:

      calendar = new YAHOO.widget.Calendar(arg["id"], arg["container"]);
      calendar.onSelect = set_date;
      calendar_widget[arg["id"]].render;

      function set_date(e) 
      {
      e = (e) ? e.target.id : window.event.srcElement.id;

              alert(e.target.id) // Output => Undefined
      }

      Using Gecko-based browser, I got undefined as an output. My question
      how could I get the id for a yahoo object when the set_date() event
      handler function is triggered?.

      I always do this using native HTML object.

      I am looking forward to hearing your comments.

      Kind regards,

      Orlando.






      ------------------------ Yahoo! Groups Sponsor --------------------~--> 
      You can search right from your browser? It's easy and it's free.  See how.
      --------------------------------------------------------------------~-> 


      Yahoo! Groups Links

      <*> To visit your group on the web, go to:

      <*> To unsubscribe from this group, send an email to:

      <*> Your use of Yahoo! Groups is subject to:





    • o_j_p_p
      ... Hello Eric, I test this: function init() { for (c = 0; c
      Message 2 of 7 , May 12, 2006
        --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
        >
        > Orlando,
        >
        > A solution to the problem of getting the date-cell's dom element (and/
        > or that cell's id) is documented here:
        >
        > http://yuiblog.com/sandbox/yui/v010/examples/calendar/
        > calendar_getcellindom.php
        >
        > Good luck with your project!
        >
        > Regards,
        > Eric
        >
        >
        > On May 10, 2006, at 12:14 PM, o_j_p_p wrote:
        >
        > > Hello everyone,
        > >
        > > I am trying to get the id for a yahoo object through a set_date()
        > > function set as its onSelect event handler.
        > >
        > > Here is the code:
        > >
        > > calendar = new YAHOO.widget.Calendar(arg["id"], arg["container"]);
        > > calendar.onSelect = set_date;
        > > calendar_widget[arg["id"]].render;
        > >
        > > function set_date(e)
        > > {
        > > e = (e) ? e.target.id : window.event.srcElement.id;
        > >
        > > alert(e.target.id) // Output => Undefined
        > > }
        > >
        > > Using Gecko-based browser, I got undefined as an output. My question
        > > how could I get the id for a yahoo object when the set_date() event
        > > handler function is triggered?.
        > >
        > > I always do this using native HTML object.
        > >
        > > I am looking forward to hearing your comments.
        > >
        > > Kind regards,
        > >
        > > Orlando.
        > >
        > >
        > >
        > >
        > >
        > >
        > > ------------------------ Yahoo! Groups Sponsor --------------------
        > > ~-->
        > > You can search right from your browser? It's easy and it's free.
        > > See how.
        > > http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/edFolB/TM
        > > --------------------------------------------------------------------
        > > ~->
        > >
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        >


        Hello Eric,

        I test this:

        function init()
        {
        for (c = 0; c < arguments.length; c++)
        {
        arg = arguments[c];

        try
        {
        div_ref = create_div(arg["id"], "absolute", "none");
        document.body.appendChild(div_ref);

        calendar_widget = [];
        calendar_widget[arg["id"]] = new YAHOO.widget.Calendar(arg["id"],
        arg["container"]);
        calendar_widget[arg["id"]].onSelect = set_date; // onSelect trigger
        calendar_widget[arg["id"]].render();

        YAHOO.util.Event.addListener(arg["container"], "click",
        calendar_widget[arg["id"]].set_date, calendar_widget[arg["id"]],
        true);

        get(arg["image"]).onclick = show_calendar;

        }
        catch(e)
        {
        alert(e);
        return false;
        }
        }
        }

        function set_date(e)
        {
        var thisTarget = YAHOO.util.Event.getTarget(e);

        alert(thisTarget);
        }


        I am getting this Javascript Error:

        Event.js (Line 534):

        var t = ev.target || ev.srcElement;

        "Error: ev has no properties"

        I am looking forward to hearing your comments.

        Regards,

        Orlando.
      • o_j_p_p
        ... (and/ ... trigger ... Hello Eric, I just want to get the calendar object when the onSelect eventhander is triggered. I am looking forward to getting back
        Message 3 of 7 , May 12, 2006
          --- In ydn-javascript@yahoogroups.com, "o_j_p_p" <opozo.yui@...> wrote:
          >
          > --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@> wrote:
          > >
          > > Orlando,
          > >
          > > A solution to the problem of getting the date-cell's dom element
          (and/
          > > or that cell's id) is documented here:
          > >
          > > http://yuiblog.com/sandbox/yui/v010/examples/calendar/
          > > calendar_getcellindom.php
          > >
          > > Good luck with your project!
          > >
          > > Regards,
          > > Eric
          > >
          > >
          > > On May 10, 2006, at 12:14 PM, o_j_p_p wrote:
          > >
          > > > Hello everyone,
          > > >
          > > > I am trying to get the id for a yahoo object through a set_date()
          > > > function set as its onSelect event handler.
          > > >
          > > > Here is the code:
          > > >
          > > > calendar = new YAHOO.widget.Calendar(arg["id"], arg["container"]);
          > > > calendar.onSelect = set_date;
          > > > calendar_widget[arg["id"]].render;
          > > >
          > > > function set_date(e)
          > > > {
          > > > e = (e) ? e.target.id : window.event.srcElement.id;
          > > >
          > > > alert(e.target.id) // Output => Undefined
          > > > }
          > > >
          > > > Using Gecko-based browser, I got undefined as an output. My question
          > > > how could I get the id for a yahoo object when the set_date() event
          > > > handler function is triggered?.
          > > >
          > > > I always do this using native HTML object.
          > > >
          > > > I am looking forward to hearing your comments.
          > > >
          > > > Kind regards,
          > > >
          > > > Orlando.
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > > ------------------------ Yahoo! Groups Sponsor --------------------
          > > > ~-->
          > > > You can search right from your browser? It's easy and it's free.
          > > > See how.
          > > > http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/edFolB/TM
          > > >
          --------------------------------------------------------------------
          > > > ~->
          > > >
          > > >
          > > > Yahoo! Groups Links
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > >
          >
          >
          > Hello Eric,
          >
          > I test this:
          >
          > function init()
          > {
          > for (c = 0; c < arguments.length; c++)
          > {
          > arg = arguments[c];
          >
          > try
          > {
          > div_ref = create_div(arg["id"], "absolute", "none");
          > document.body.appendChild(div_ref);
          >
          > calendar_widget = [];
          > calendar_widget[arg["id"]] = new YAHOO.widget.Calendar(arg["id"],
          > arg["container"]);
          > calendar_widget[arg["id"]].onSelect = set_date; // onSelect
          trigger
          > calendar_widget[arg["id"]].render();
          >
          > YAHOO.util.Event.addListener(arg["container"], "click",
          > calendar_widget[arg["id"]].set_date, calendar_widget[arg["id"]],
          > true);
          >
          > get(arg["image"]).onclick = show_calendar;
          >
          > }
          > catch(e)
          > {
          > alert(e);
          > return false;
          > }
          > }
          > }
          >
          > function set_date(e)
          > {
          > var thisTarget = YAHOO.util.Event.getTarget(e);
          >
          > alert(thisTarget);
          > }
          >
          >
          > I am getting this Javascript Error:
          >
          > Event.js (Line 534):
          >
          > var t = ev.target || ev.srcElement;
          >
          > "Error: ev has no properties"
          >
          > I am looking forward to hearing your comments.
          >
          > Regards,
          >
          > Orlando.
          >


          Hello Eric,

          I just want to get the calendar object when the onSelect eventhander
          is triggered.

          I am looking forward to getting back from you.

          Kind regards,

          Orlando.
        • Eric Miraglia
          Orlando, Your Calendar instance s onSelect method isn t a DOM event -- it s an API method for Calendar. As such, it doesn t get passed the Event object in the
          Message 4 of 7 , May 12, 2006
            Orlando,

            Your Calendar instance's onSelect method isn't a DOM event -- it's an API method for Calendar.  As such, it doesn't get passed the Event object in the way that a DOM event does.  Note that in the example I wrote up for you (http://yuiblog.com/sandbox/yui/v010/examples/calendar/calendar_getcellindom.php) I listened for an actual DOM event, onClick; I didn't attach my event handler to onSelect.

            Regards,
            Eric


            On May 12, 2006, at 9:45 AM, o_j_p_p wrote:

            --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:

            Orlando,

            A solution to the problem of getting the date-cell's dom element (and/ 
            or that cell's id) is documented here:

            calendar_getcellindom.php

            Good luck with your project!

            Regards,
            Eric


            On May 10, 2006, at 12:14 PM, o_j_p_p wrote:

            Hello everyone,

            I am trying to get the id for a yahoo object through a set_date()
            function set as its onSelect event handler.

            Here is the code:

            calendar = new YAHOO.widget.Calendar(arg["id"], arg["container"]);
            calendar.onSelect = set_date;
            calendar_widget[arg["id"]].render;

            function set_date(e)
            {
            e = (e) ? e.target.id : window.event.srcElement.id;

                    alert(e.target.id) // Output => Undefined
            }

            Using Gecko-based browser, I got undefined as an output. My question
            how could I get the id for a yahoo object when the set_date() event
            handler function is triggered?.

            I always do this using native HTML object.

            I am looking forward to hearing your comments.

            Kind regards,

            Orlando.






            ------------------------ Yahoo! Groups Sponsor -------------------- 
            ~-->
            You can search right from your browser? It's easy and it's free.   
            See how.
            -------------------------------------------------------------------- 
            ~->


            Yahoo! Groups Links










            Hello Eric,

            I test this:

            function init() 
            {
            for (c = 0; c < arguments.length; c++) 
            {
            arg = arguments[c];

            try 
            {
            div_ref = create_div(arg["id"], "absolute", "none");
            document.body.appendChild(div_ref);


            calendar_widget = [];
            calendar_widget[arg["id"]] = new YAHOO.widget.Calendar(arg["id"],
            arg["container"]);
            calendar_widget[arg["id"]].onSelect = set_date; // onSelect trigger 
            calendar_widget[arg["id"]].render();


            YAHOO.util.Event.addListener(arg["container"], "click",
            calendar_widget[arg["id"]].set_date, calendar_widget[arg["id"]],
            true); 


            get(arg["image"]).onclick = show_calendar;


            }
            catch(e)
            {
            alert(e);
            return false;
            }
            }
            }

            function set_date(e) 
            {
            var thisTarget = YAHOO.util.Event.getTarget(e); 


            alert(thisTarget);
            }


            I am getting this Javascript Error:

            Event.js (Line 534):

            var t = ev.target || ev.srcElement;

            "Error: ev has no properties"

            I am looking forward to hearing your comments.

            Regards,

            Orlando.





            ------------------------ Yahoo! Groups Sponsor --------------------~--> 
            Get to your groups with one click. Know instantly when new email arrives
            --------------------------------------------------------------------~-> 


            Yahoo! Groups Links

            <*> To visit your group on the web, go to:

            <*> To unsubscribe from this group, send an email to:

            <*> Your use of Yahoo! Groups is subject to:






          • Eric Miraglia
            ... Orlando, That s much simpler than getting at the Calendar s DOM. onSelect fires in the Calendar instance s scope, so this within your onSelect function
            Message 5 of 7 , May 12, 2006
              > I just want to get the calendar object when the onSelect eventhander
              > is triggered.

              Orlando,

              That's much simpler than getting at the Calendar's DOM. onSelect
              fires in the Calendar instance's scope, so "this" within your
              onSelect function is a reference to your Calendar instance.

              Regards,
              Eric
            • o_j_p_p
              ... Hello Eric, That worked properly, thanks. Kind regards, Orlando.
              Message 6 of 7 , May 12, 2006
                --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
                >
                > > I just want to get the calendar object when the onSelect eventhander
                > > is triggered.
                >
                > Orlando,
                >
                > That's much simpler than getting at the Calendar's DOM. onSelect
                > fires in the Calendar instance's scope, so "this" within your
                > onSelect function is a reference to your Calendar instance.
                >
                > Regards,
                > Eric
                >


                Hello Eric,

                That worked properly, thanks.

                Kind regards,

                Orlando.
              Your message has been successfully submitted and would be delivered to recipients shortly.