Click here to Skip to main content
15,887,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add angrument "max" into this function ?
so that the output will print 1 to "max" instead of 100

What I have tried:





";
for ($row=1; $row <= 20; $row++) {
echo " \n";
for ($col=1; $col <= 5; $col++) {
$p = $col * $row;
echo "$p \n";
}
echo "";
}
echo "";

}

echo print_number("");

?>
Posted
Updated 4-Jun-20 8:30am

Start by declaring the function properly. All you have above is some random lines of Javascript. If you want to pass a parameter to a function then your function definition must include a name for the parameter, using the function from your other question you could have something like:
JavaScript
function getPrice(discount) { // discount is the value to apply to orders  above 10 units
    var price = Number(document.getElementById("p1").value);
    var qty = Number(document.getElementById("q1").value);
    var total = price * qty;
    if (qty > 10) {
        total = total * discount;
    }
}
 
Share this answer
 
v3
You may need a lot more help than in the first answer. If so, I suggest JavaScript Functions[^]

It wouldn't help to do the whole tutorial - they're pretty good and will help you close knowledge gaps you didn't even know you had.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900