The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums

    JavaScript question

    avatar
    Guest
    Guest


    JavaScript question  Empty JavaScript question

    Post by Guest June 17th 2015, 1:00 am

    Is it possible to program a code that allows a attack button to automatically do hp like these examples 
    Code:


    [code]

     document.getElementById("attack").click(); = dragon.hp = dragon.hp - 10;

    [size=13][code]document.getElementById("attack").onclick = function(){
        dragon.hp -[/code][/size]
    [size=13][code]document.getElementById("attack").addEventListener('click', function(){
        dragon.hp -= 10;
    });[/code]
    [code]dragon.hp -= 10;[/code]

    [code]dragon.hp = dragon.hp - 10;[/code][
       <a ..... onClick="deductHpPoints()">...</a>[/code][code]            Function deductHpPoints()
                {
                  //deduct logic
                 }[/code]
    [color=#000000]
    Like this code shown to work with a rpg character sheet

      Current date/time is November 11th 2024, 5:34 pm