Button with onclick

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drthorogood
    New Member
    • Feb 2008
    • 4

    Button with onclick

    Hi Guys,
    I think this will be very easy for you experts but I am a real novice with scripts.

    I have a text link {LINKONLY}Book</a> where {LINKONLY} is defined in the site. I wish to change to a button with onclick function but do not know where the {LINKONLY} needs to go in the script.

    <input name="details" type="submit" class="button" id="details" onclick="?????" value="details" />

    Any help gratefully accepted

    David
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    [html]<button name="details" class="button" id="details" onclick="window .location = '{LINKONLY}';"> Details</button>[/html]

    If you have to use it for submit button, add the link to the action attribute of the form tag.[html]<form action="{LINKON LY}" name="f" method="get | post">[/html]

    PS: I am considering {LINKONLY} something like abcdef.htm
    Last edited by hsriat; Feb 29 '08, 04:00 PM. Reason: Mistake reading the code

    Comment

    • drthorogood
      New Member
      • Feb 2008
      • 4

      #3
      Originally posted by hsriat
      [html]<button name="details" class="button" id="details" onclick="window .location = '{LINKONLY}';"> Details</button>[/html]

      If you have to use it for submit button, add the link to the action attribute of the form tag.[html]<form action="{LINKON LY}" name="f" method="get | post">[/html]

      PS: I am considering {LINKONLY} something like abcdef.htm
      Hi,
      Thanks for the reply but its not correct. The {LINKONLY} is not a link to a standard page but a link to a booking form. {LINKONLY} is defining a <h ref .....
      David

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        Originally posted by drthorogood
        Hi,
        Thanks for the reply but its not correct. The {LINKONLY} is not a link to a standard page but a link to a booking form. {LINKONLY} is defining a <h ref .....
        David

        Can you please explain a little bit more what this {LINKONLY} is, and what are to trying to attain?

        Comment

        • drthorogood
          New Member
          • Feb 2008
          • 4

          #5
          Originally posted by hsriat
          Can you please explain a little bit more what this {LINKONLY} is, and what are to trying to attain?

          At the moment the code looks like this:

          <td class="property list_rightcol" width="160" valign="top">
          <a href="{MOREINFO RMATIONLINK}">{ MOREINFORMATION }</a>
          <br/>{LINKONLY}{BOO KTHIS_TEXT}</a></td>

          I think the LINKONLY is replaced by

          "<a href=\"".jomres URL("index.php? option=com_jomr es&task=dobooki ng&amp;Itemid=$ Itemid&amp;sele ctedProperty=". $property->propertys_uid) ."\" title=\"".jr_ge ttext('_JOMRES_ FRONT_MR_MENU_B OOKAROOM',_JOMR ES_FRONT_MR_MEN U_BOOKAROOM,$ed itable=false,$i sLink=true)."\" >";

          Which is defined in another part of the site.

          The {BOOKTHIS_TEXT} is defined as a text link Book Rooms

          I would like to replace the Text link with a Styled Button.

          David

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            I think that's not possible unless to change {LINKONLY}'s internal string.

            When the file will be processed, {LINKONLY} will be replaced to that <a _ _ _ _ _> right?

            So you would need to make a change in that part of you code which generates {LINKONLY}.

            Comment

            • drthorogood
              New Member
              • Feb 2008
              • 4

              #7
              Originally posted by hsriat
              I think that's not possible unless to change {LINKONLY}'s internal string.

              When the file will be processed, {LINKONLY} will be replaced to that <a _ _ _ _ _> right?

              So you would need to make a change in that part of you code which generates {LINKONLY}.
              Ok Thanks for trying, I will look at it next week.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by drthorogood
                Ok Thanks for trying, I will look at it next week.
                It is possible to change it, but it would be better doing this on the server-side.

                If you were to do this via JavaScript, you could get the link element either via its ID if you have it set or document.getEle mentsByTagName( "a") and getting the correct link. Then get it's href property for the link and use replaceChild to replace the link with the newly created button which goes to the href link onclick.

                Comment

                Working...