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

Re: onSelect() not working properly for Internet Explorer

Expand Messages
  • sfmatt1982
    Stephen, Thank you for your expertise! Problem solved! For reference, and anyone else interested, after I instantiated my calendar object, I copied the code
    Message 1 of 5 , May 31 3:37 PM
    • 0 Attachment
      Stephen,

      Thank you for your expertise! Problem solved!

      For reference, and anyone else interested, after I instantiated my
      calendar object, I copied the code from calendar.js for the function
      referenced, and changed the code to inclde my own javascript function
      on the href:

      // Instantiate calendar
      YAHOO.foo.cal1 = new
      YAHOO.widget.Calendar("YAHOO.foo.cal1","cal1Container","<%=yahooMonth%>","");
      // Can't choose today
      YAHOO.foo.cal1.addRenderer("<%=todayDate%>",YAHOO.foo.cal1.renderBodyCellRestricted);

      // Add click handler
      YAHOO.widget.Calendar_Core.prototype.renderCellDefault =
      function(workingDate, cell) {
      cell.innerHTML = "";
      var link = document.createElement("a");

      // handleCalChoice is our JS function to handle a calendar object
      choice. Woot.
      link.href="javascript:handleCalChoice();";

      link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();
      link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));
      cell.appendChild(link);
      }


      --- In ydn-javascript@yahoogroups.com, "Steven Peterson"
      <peterson@...> wrote:

      >
      > Matt -
      >
      >
      >
      > I don't have a specific example, but to get you started, I can
      suggest that
      > you try modifying this function:
      > YAHOO.widget.Calendar_Core.prototype.renderCellDefault. This is
      where the
      > link is actually created, and should give you a good starting point.
      >
      >
      >
      > Steven Peterson
      >
      > Web Developer, Platform Engineering
      >
      > Yahoo!
      >
      > From: ydn-javascript@yahoogroups.com
      [mailto:ydn-javascript@yahoogroups.com]
      > On Behalf Of sfmatt1982
      > Sent: Tuesday, May 30, 2006 5:13 PM
      > To: ydn-javascript@yahoogroups.com
      > Subject: [ydn-javascript] Re: onSelect() not working properly for
      Internet
      > Explorer
      >
      >
      >
      > Stephen,
      >
      > Excellent, thanks for the info. You wouldn't happen to have an
      > example of adding a renderer that contained a simple link, or a link
      > including the selected date?
      >
      > Thanks,
      >
      > Matt
      > --- In ydn-javascript@yahoogroups.com, "Steven Peterson"
      > <peterson@> wrote:
      > >
      > > Matt,
      > >
      > >
      > >
      > > The onSelect handler is actually meant to be used anytime a
      selection is
      > > made, programmatically, or through a click, so handling it this
      way will
      > > probably not give you the behavior you want. You would probably be
      > better
      > > off rendering your cells so that clicking the link takes you to the
      > new URL.
      > > You will get a more reliable location change that way. I'm not
      > precisely
      > > sure why IE would have this behavior, but from past experience I
      suspect
      > > that it has to do with some weirdness around trying to change
      > location when
      > > there is still other JS to execute (which occurs after onSelect). Try
      > > changing the way that the cell is rendered and see if you can get the
      > > behavior you want that way.
      > >
      > >
      > >
      > > Thanks!
      > >
      > > Steven Peterson
      > >
      > > Web Developer, Platform Engineering
      > >
      > > Yahoo!
      > >
      > > From: ydn-javascript@yahoogroups.com
      > [mailto:ydn-javascript@yahoogroups.com]
      > > On Behalf Of sfmatt1982
      > > Sent: Tuesday, May 30, 2006 11:51 AM
      > > To: ydn-javascript@yahoogroups.com
      > > Subject: [ydn-javascript] onSelect() not working properly for Internet
      > > Explorer
      > >
      > >
      > >
      > > Hi fellow YUI devs, I'm having a problem with the onSelect() method
      > > with the Calendar object. In this example code:
      > >
      > > YAHOO.foo.cal1.onSelect = function() {
      > > window.location.href = "http://www.news.com"; };
      > >
      > > When I click a date in Firefox, the window correctly forwards to
      > > news.com, however in IE, about 80% of the time nothing will occur
      > > (with no javascript error), and if I click furiously, occasionally it
      > > will forward me on.
      > >
      > > Any ideas?
      > >
      > > Thanks,
      > >
      > > Matt
      > >
      > >
      > >
      > >
      > >
      > >
      > > SPONSORED LINKS
      > >
      > >
      > > C
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=C+programming+language&w1=C+programming
      > > &k=C+programming+language&w1=C+programming
      > >
      >
      +language&w2=Computer+programming+languages&w3=Java+programming+language&w4=
      > >
      >
      The+c+programming+language&w5=C+++programming+language&w6=Concept+of+program
      > > ming+language&c=6&s=194&.sig=lC1PxfzvANy_Br-nPkXYTA> programming
      > language
      > >
      > > Computer
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=C+pro
      > > &k=Computer+programming+languages&w1=C+pro
      > >
      >
      gramming+language&w2=Computer+programming+languages&w3=Java+programming+lang
      > >
      >
      uage&w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of
      > > +programming+language&c=6&s=194&.sig=7XFXh-0Mon1IfLuOVlwvdg>
      > programming
      > > languages
      > >
      > > Java
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=C+programm
      > > &k=Java+programming+language&w1=C+programm
      > >
      >
      ing+language&w2=Computer+programming+languages&w3=Java+programming+language&
      > >
      >
      w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+prog
      > > ramming+language&c=6&s=194&.sig=UITodqn0qTCUcae_mpRQog> programming
      > > language
      > >
      > >
      > > The
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=The+c+programming+language&w1=C+program
      > > &k=The+c+programming+language&w1=C+program
      > >
      >
      ming+language&w2=Computer+programming+languages&w3=Java+programming+language
      > >
      >
      &w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+pro
      > > gramming+language&c=6&s=194&.sig=xnZC2-BzDSLhhir3MLtssg> c
      programming
      > > language
      > >
      > > C
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=C+++programming+language&w1=C+programmi
      > > &k=C+++programming+language&w1=C+programmi
      > >
      >
      ng+language&w2=Computer+programming+languages&w3=Java+programming+language&w
      > >
      >
      4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+progr
      > > amming+language&c=6&s=194&.sig=RTzTl3BOJWbWK14CdUrO0w> programming
      > language
      > >
      > >
      > > Concept
      > >
      > <http://groups.yahoo.com/gads?t=ms
      >
      <http://groups.yahoo.com/gads?t=ms&k=Concept+of+programming+language&w1=C+pr
      > > &k=Concept+of+programming+language&w1=C+pr
      > >
      >
      ogramming+language&w2=Computer+programming+languages&w3=Java+programming+lan
      > >
      >
      guage&w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+o
      > > f+programming+language&c=6&s=194&.sig=x4ueM0tA417JDq3ckdJ9CQ> of
      > > programming language
      > >
      > >
      > >
      > > _____
      > >
      > > YAHOO! GROUPS LINKS
      > >
      > >
      > >
      > > * Visit your group "ydn-javascript
      > > <http://groups.yahoo.com/group/ydn-javascript> " on the web.
      > >
      > > * To unsubscribe from this group, send an email to:
      > > ydn-javascript-unsubscribe@yahoogroups.com
      > >
      <mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe>
      > >
      > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      Service
      > > <http://docs.yahoo.com/info/terms/> .
      > >
      > >
      > >
      > > _____
      > >
      >
      >
      >
      >
      >
      >
      >
      > SPONSORED LINKS
      >
      >
      > C
      >
      <http://groups.yahoo.com/gads?t=ms&k=C+programming+language&w1=C+programming
      >
      +language&w2=Computer+programming+languages&w3=Java+programming+language&w4=
      >
      The+c+programming+language&w5=C+++programming+language&w6=Concept+of+program
      > ming+language&c=6&s=194&.sig=lC1PxfzvANy_Br-nPkXYTA> programming
      language
      >
      > Computer
      >
      <http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=C+pro
      >
      gramming+language&w2=Computer+programming+languages&w3=Java+programming+lang
      >
      uage&w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of
      > +programming+language&c=6&s=194&.sig=7XFXh-0Mon1IfLuOVlwvdg>
      programming
      > languages
      >
      > Java
      >
      <http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=C+programm
      >
      ing+language&w2=Computer+programming+languages&w3=Java+programming+language&
      >
      w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+prog
      > ramming+language&c=6&s=194&.sig=UITodqn0qTCUcae_mpRQog> programming
      > language
      >
      >
      > The
      >
      <http://groups.yahoo.com/gads?t=ms&k=The+c+programming+language&w1=C+program
      >
      ming+language&w2=Computer+programming+languages&w3=Java+programming+language
      >
      &w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+pro
      > gramming+language&c=6&s=194&.sig=xnZC2-BzDSLhhir3MLtssg> c programming
      > language
      >
      > C
      >
      <http://groups.yahoo.com/gads?t=ms&k=C+++programming+language&w1=C+programmi
      >
      ng+language&w2=Computer+programming+languages&w3=Java+programming+language&w
      >
      4=The+c+programming+language&w5=C+++programming+language&w6=Concept+of+progr
      > amming+language&c=6&s=194&.sig=RTzTl3BOJWbWK14CdUrO0w> programming
      language
      >
      >
      > Concept
      >
      <http://groups.yahoo.com/gads?t=ms&k=Concept+of+programming+language&w1=C+pr
      >
      ogramming+language&w2=Computer+programming+languages&w3=Java+programming+lan
      >
      guage&w4=The+c+programming+language&w5=C+++programming+language&w6=Concept+o
      > f+programming+language&c=6&s=194&.sig=x4ueM0tA417JDq3ckdJ9CQ> of
      > programming language
      >
      >
      >
      > _____
      >
      > YAHOO! GROUPS LINKS
      >
      >
      >
      > * Visit your group "ydn-javascript
      > <http://groups.yahoo.com/group/ydn-javascript> " on the web.
      >
      > * To unsubscribe from this group, send an email to:
      > ydn-javascript-unsubscribe@yahoogroups.com
      > <mailto:ydn-javascript-unsubscribe@yahoogroups.com?subject=Unsubscribe>
      >
      > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
      > <http://docs.yahoo.com/info/terms/> .
      >
      >
      >
      > _____
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.