using javascript to create a radio button out of an anchor.

Discussion in 'Scripts' started by Phreaddee, Nov 11, 2011.

to remove all ads.
  1. Phreaddee

    Phreaddee Super Moderator Staff Member

    Messages:
    1,978
    Hi.
    not even sure if this is possible but...
    I've got a client and they are using Business Catalyst as their CMS.
    within the ecommerce section you can create attributes and have them listed as a radiobutton list, but to group similar products together can only be outputted as a crummy table (see below example output)
    HTML:
    <table cellspacing="0" class="productTable">
    <tr>
    <td class="productItem"><a href="/linktoproductA.html">groupedproduct-A</a></td>
    </tr>
    <tr>
    <td class="productItem"><a href="/linktoproductB.html">groupedproduct-B</a></td>
    </tr>
    <tr>
    <td class="productItem"><a href="/linktoproductC.html">groupedproduct-C</a></td>
    </tr>
    </table>
    
    Personally I'd love to be able to remove the table entirely,
    however at the very least I'd love to be able to modify the anchor to be outputted as a radiobutton
    but is this even possible?
    (even if it is purely visual so that it appears to work like a radio button but doesnt. - that'll keep the client happy.
    any thoughts?

    cheers
     
  2. DesignerBill

    DesignerBill New Member

    Messages:
    145
    please clarify

    Phreaddee, first time I've known you to ASK a question, since I've been here. :)

    I don't quite understand what you want to do. Do you want a click on the radiobutton to display the associated link? Maybe a simple image of the desired effect would make it more clear.
     
  3. MarkR

    MarkR New Member

    Messages:
    105
    Hmm, we did something similar to this a while back but kind of faked it.


    HTML:
    <a href="#" title="Show/Hide">
    <img src="/img/closed_icon.png" alt="Closed"/>
    </a>
    
    
    <img src="/img/closed_icon.png" alt="Closed"/>
    or
    <img src="/img/open_icon.png" alt="Open"/>
    
    The images just look like radio buttons which are swapped using JS when clicked. It's cheating a bit but it was quick and easy.
     
  4. Phreaddee

    Phreaddee Super Moderator Staff Member

    Messages:
    1,978
    Yes! U r a legend...
    I think youve solved my problem!
     

Share This Page