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

Re: [ydn-javascript] how to assign URL to a widget button?

Expand Messages
  • Todd Kloots
    hooked2trance - Buttons have a type attribute that determine their core behavior. If you want a Button that behaves like an HTML anchor element, specify
    Message 1 of 2 , Aug 21, 2008
    • 0 Attachment
      "hooked2trance" -

      Buttons have a "type" attribute that determine their core behavior. If
      you want a Button that behaves like an HTML anchor element, specify the
      type "link". Then use the "href" and "target" attributes as you would
      with an HTML anchor:

      var oButton = new YAHOO.widget.Button({
      id: "ok-button",
      type: "link",
      href: "SOME URL HERE",
      target: "SOME TARGET",
      label: "Click here to purchase your tickets",
      container: "buttoncontainer"
      });

      hooked2trance wrote:
      >
      > Hi all,
      >
      > I am very very new to YUI and javascript, so I will need help from
      > you guys...
      >
      > I have managed to add the YUI glowing button stuff to my website. I
      > am hoping that a new internet browser window be opened when the
      > glowing button is pressed. However, I am not sure where to add the
      > URL to the code, and what command I must type into the following code:
      >
      > <script type="text/javascript">
      > YAHOO.util.Event.onContentReady("buttoncontainer", function
      > () {
      > var oButton = new YAHOO.widget.Button({
      > id: "ok-button",
      > label: "Click here to purchase your tickets",
      > container: "buttoncontainer" });
      > oButton.on("appendTo", function () {
      > if (YAHOO.env.ua.ie == 6) {
      > oButton.addClass("ie6");
      > }
      > var oButtonAnim = new YAHOO.util.ColorAnim("ok-
      > button", { backgroundColor: { to: "#51abb4" } });
      > oButtonAnim.onComplete.subscribe(function () {
      > this.attributes.backgroundColor.to =
      > (this.attributes.backgroundColor.to
      > == "#51abb4") ? "#000431" : "#51abb4";
      > this.animate();
      > });
      > oButtonAnim.animate();
      > });
      > });
      > </script>
      >
      > I did not paste the above script onto another javascript file as my
      > website does not need that many JS files and I decided to paste it on
      > the html file itself. I hope that is ok?
      >
      > Please advise... I am honestly getting a headache trying to figure
      > this out...
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.