Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Apr 2014
    Location
    Los Angeles
    Posts
    3
    Member #
    38965

    Function Call using event trigger from Javascript

    Hi,

    I am looking for to have Page numbers on my website and click event on each of them should call a function passing page number. I wrote below code, however unsure how can I call function onClick event.

    <!DOCTYPE html>
    <head>
    <script>
    function showText(){
    document.write("function called"+ i);
    }
    </script>
    </head>
    <body>
    <script>
    document.write("<center>" +"Page");
    for (var i=1;i<4;i++){
    document.write ("<button>"+i+"</button>"); /* I want to call function here passing value of i */
    }
    document.write("</center>");
    </script>
    </body>
    </html>

    1. If there is anyway Not to use buttons and simply call function by textclick event passing value of i would be great. O/p of above code is as below

    Page 1 2 3

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:56 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com