Welcome to TalkGraphics.com
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,889

    Default Re: Passing button ID

    Duplicate - see below
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  2. #12
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,889

    Default Re: Passing button ID

    Quote Originally Posted by siran View Post
    Not sure if that is what you are looking for. "this" just doesn't work in href, so you have to modify it. Have a look at the attached example.
    I have taken the liberty of developing your code:
    Code:
    <script>
    function myFunction(id){
    alert(id);
    }
    var h = document.getElementsByClassName("formButton");
    for (var i=0;i<h.length;i++) {
       h[i].parentElement.setAttribute('href',"javascript:myFunction('"+h[i].id+"');");
    }
    </script>
    I removed #IDTST for # in the Links.
    I added htmlclass=formButton to the button Names.

    @naz - the code in in the Page's Body.
    You would change myFunction() to validate_forms().

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  3. #13
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Passing button ID

    Cool, I did not know the htmlclass name. There is always something to learn here...

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •