kangal26 Posted March 2, 2015 Share Posted March 2, 2015 in a website two buttonsone is HI and another one is Lowwhen we click those buttons the result will shows as lose or win.i need a script starting from Click HI Button till to 3 winning continuously.when result shows WIN - continuously 3 times on using HI Button the 4th time i want to click LOW buttonif low button result is win the program will start from HI Button Again.if Low button result is Lose click again and again Low button till to win. after that the from the top (loop) HI Buttoni need that script. please send me the scripthanks with regards Prabhu Link to comment Share on other sites More sharing options...
davej Posted March 2, 2015 Share Posted March 2, 2015 I am not going to try to figure out what you actually need. You will have to study the tutorial and write it yourself. See... http://www.w3schools.com/js/ ...but I will get you started with this example file... <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>title</title><style>[type=button]{margin:10px;color:blue;}</style><script>window.onerror = function(a, b, c, d){alert('Javascript Error:n'+a+'nURL: '+b+'nLine: '+c+' Column: '+d);return true;}</script><script>'use strict';var hicount; // globalsvar lowcount;var out;window.onload = init;function init() {document.getElementById('btnHi').onclick = fnHi;document.getElementById('btnLow').onclick = fnLow;out = document.getElementById('out');hicount = 0;lowcount = 0;}function fnHi(){hicount++;fnCalc();}function fnLow(){lowcount++;fnCalc();}function fnCalc(){var hiwin = "";var lowin = "";if (lowcount>5){lowin = "LO_WIN"}if (hicount>5){hiwin = "HI_WIN"}out.innerHTML = 'HI = ' + hicount + ' ' + hiwin + ' LOW = ' + lowcount + ' ' + lowin;}</script></head><body><hr/><input type="button" id="btnHi" value="HI"><input type="button" id="btnLow" value="LOW"><hr/><div id="out"></div></body> </html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now