Note that there are some explanatory texts on larger screens.

plurals
  1. POSave the changes done in running the html (in browser)
    primarykey
    data
    text
    <p>I have a simple subject reservation here made up of html, css, javascript, and jquery. I would like to ask if is it possible that if for example there are 5 remaining slots, if i clicked the "Reserve" button it will decrease into 4. So, there are 4 remaining slots already. If I close the browser or restart the computer and when I will run again the program, the remaining slots will remain 4. Is it possible?</p> <p>This is my code:</p> <pre><code>&lt;script type="text/javascript"&gt; var availableSlot1 = 5; var reduceSlot1 = function(valueToDeduct1){ availableSlot1 = availableSlot1 - valueToDeduct1; document.getElementById('ite164').innerHTML = availableSlot1; if (availableSlot1 == 0){ document.getElementById('ite164').innerHTML = "FULL"; document.getElementById("ite164").style.color = "red"; document.getElementById("number1").style.color = "red"; document.getElementById("subject1").style.color = "red"; document.getElementById("code1").style.color = "red"; document.getElementById("units1").style.color = "red"; document.getElementById("prof1").style.color = "red"; document.getElementById("1").style.display = "none"; } }; var availableSlot2 = 5; var reduceSlot2 = function(valueToDeduct2){ availableSlot2 = availableSlot2 - valueToDeduct2; document.getElementById('phi001').innerHTML = availableSlot2; if (availableSlot2 == 0){ document.getElementById('phi001').innerHTML = "FULL"; document.getElementById("phi001").style.color = "red"; document.getElementById("number2").style.color = "red"; document.getElementById("subject2").style.color = "red"; document.getElementById("code2").style.color = "red"; document.getElementById("units2").style.color = "red"; document.getElementById("prof2").style.color = "red"; document.getElementById("2").style.display = "none"; } }; var availableSlot3 = 5; var reduceSlot3 = function(valueToDeduct3){ availableSlot3 = availableSlot3 - valueToDeduct3; document.getElementById('ite165').innerHTML = availableSlot3; if (availableSlot3 == 0){ document.getElementById('ite165').innerHTML = "FULL"; document.getElementById("ite165").style.color = "red"; document.getElementById("number3").style.color = "red"; document.getElementById("subject3").style.color = "red"; document.getElementById("code3").style.color = "red"; document.getElementById("units3").style.color = "red"; document.getElementById("prof3").style.color = "red"; document.getElementById("3").style.display = "none"; } }; var availableSlot4 = 5; var reduceSlot4 = function(valueToDeduct4){ availableSlot4 = availableSlot4 - valueToDeduct4; document.getElementById('ite048').innerHTML = availableSlot4; if (availableSlot4 == 0){ document.getElementById('ite048').innerHTML = "FULL"; document.getElementById("ite048").style.color = "red"; document.getElementById("number4").style.color = "red"; document.getElementById("subject4").style.color = "red"; document.getElementById("code4").style.color = "red"; document.getElementById("units4").style.color = "red"; document.getElementById("prof4").style.color = "red"; document.getElementById("4").style.display = "none"; } }; var availableSlot5 = 5; var reduceSlot5 = function(valueToDeduct5){ availableSlot5 = availableSlot5 - valueToDeduct5; document.getElementById('ite136').innerHTML = availableSlot5; if (availableSlot5 == 0){ document.getElementById('ite136').innerHTML = "FULL"; document.getElementById("ite136").style.color = "red"; document.getElementById("number5").style.color = "red"; document.getElementById("subject5").style.color = "red"; document.getElementById("code5").style.color = "red"; document.getElementById("units5").style.color = "red"; document.getElementById("prof5").style.color = "red"; document.getElementById("5").style.display = "none"; } }; var availableSlot6 = 5; var reduceSlot6 = function(valueToDeduct6){ availableSlot6 = availableSlot6 - valueToDeduct6; document.getElementById('ite062').innerHTML = availableSlot6; if (availableSlot6 == 0){ document.getElementById('ite062').innerHTML = "FULL"; document.getElementById("ite062").style.color = "red"; document.getElementById("number6").style.color = "red"; document.getElementById("subject6").style.color = "red"; document.getElementById("code6").style.color = "red"; document.getElementById("units6").style.color = "red"; document.getElementById("prof6").style.color = "red"; document.getElementById("6").style.display = "none"; } }; var availableSlot7 = 5; var reduceSlot7 = function(valueToDeduct7){ availableSlot7 = availableSlot7 - valueToDeduct7; document.getElementById('ite076').innerHTML = availableSlot7; if (availableSlot7 == 0){ document.getElementById('ite076').innerHTML = "FULL"; document.getElementById("ite076").style.color = "red"; document.getElementById("number7").style.color = "red"; document.getElementById("subject7").style.color = "red"; document.getElementById("code7").style.color = "red"; document.getElementById("units7").style.color = "red"; document.getElementById("prof7").style.color = "red"; document.getElementById("7").style.display = "none"; } }; $(document).ready(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").hide(); $("#button4").hide(); $("#button5").hide(); $("#button6").hide(); $("#button7").hide(); $("#1").click(function(){ $("#button1").show(); $("#button1").fadeIn(1000); $("#button2").hide(); $("#button3").hide(); $("#button4").hide(); $("#button5").hide(); $("#button6").hide(); $("#button7").hide(); $("#button1").click(function() { $("#button1").hide(); }); }); $("#2").click(function(){ $("#button1").hide(); $("#button2").show(); $("#button2").fadeIn(1000); $("#button3").hide(); $("#button4").hide(); $("#button5").hide(); $("#button6").hide(); $("#button7").hide(); $("#button2").click(function() { $("#button2").hide(); }); }); $("#3").click(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").show(); $("#button3").fadeIn(1000); $("#button4").hide(); $("#button5").hide(); $("#button6").hide(); $("#button7").hide(); $("#button3").click(function() { $("#button3").hide(); }); }); $("#4").click(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").hide(); $("#button4").show(); $("#button4").fadeIn(1000); $("#button5").hide(); $("#button6").hide(); $("#button7").hide(); $("#button4").click(function() { $("#button4").hide(); }); }); $("#5").click(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").hide(); $("#button4").hide(); $("#button5").show(); $("#button5").fadeIn(1000); $("#button6").hide(); $("#button7").hide(); $("#button5").click(function() { $("#button5").hide(); }); }); $("#6").click(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").hide(); $("#button4").hide(); $("#button5").hide(); $("#button6").show(); $("#button6").fadeIn(1000); $("#button7").hide(); $("#button6").click(function() { $("#button6").hide(); }); }); $("#7").click(function(){ $("#button1").hide(); $("#button2").hide(); $("#button3").hide(); $("#button4").hide(); $("#button5").hide(); $("#button6").hide(); $("#button7").show(); $("#button7").fadeIn(1000); $("#button7").click(function() { $("#button7").hide(); }); }); }); </code></pre> <p></p> <pre><code> &lt;body&gt; &lt;table border="1" width="700px"&gt; &lt;tr&gt; &lt;th&gt;#&lt;/th&gt; &lt;th&gt;Subjects&lt;/th&gt; &lt;th&gt;Subject Code&lt;/th&gt; &lt;th&gt;Units&lt;/th&gt; &lt;th&gt;Instructor&lt;/th&gt; &lt;th&gt;Available Slots&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number1"&gt;1&lt;/td&gt; &lt;td id="subject1"&gt;Data Comm. Systems &amp; Networking&lt;/td&gt; &lt;td class="center" id="code1"&gt;ITE164&lt;/td&gt; &lt;td class="center" id="units1"&gt;3.0&lt;/td&gt; &lt;td id="prof1"&gt;Quinito, Floreto Jr. R.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite164"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number2"&gt;2&lt;/td&gt; &lt;td id="subject2"&gt;Introduction to Philosophy and Logic&lt;/td&gt; &lt;td class="center" id="code2"&gt;PHI001&lt;/td&gt; &lt;td class="center" id="units2"&gt;3.0&lt;/td&gt; &lt;td id="prof2"&gt;Chiong, Isidro R.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="phi001"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number3"&gt;3&lt;/td&gt; &lt;td id="subject3"&gt;Basic Finance &amp; Acctg. Principles for IT&lt;/td&gt; &lt;td class="center" id="code3"&gt;ITE165&lt;/td&gt; &lt;td class="center" id="units3"&gt;3.0&lt;/td&gt; &lt;td id="prof3"&gt;Cadelinia, Godofredo B.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite165"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number4"&gt;4&lt;/td&gt; &lt;td id="subject4"&gt;Discrete Structures&lt;/td&gt; &lt;td class="center" id="code4"&gt;ITE048&lt;/td&gt; &lt;td class="center" id="units4"&gt;3.0&lt;/td&gt; &lt;td id="prof4"&gt;Calibara, Eunelfa Regie F.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite048"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number5"&gt;5&lt;/td&gt; &lt;td id="subject5"&gt;Web Page Design&lt;/td&gt; &lt;td class="center" id="code5"&gt;ITE136&lt;/td&gt; &lt;td class="center" id="units5"&gt;3.0&lt;/td&gt; &lt;td id="prof5"&gt;Pequiro, Chemby Mae S.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite136"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number6"&gt;6&lt;/td&gt; &lt;td id="subject6"&gt;Systems Analysis and Design&lt;/td&gt; &lt;td class="center" id="code6"&gt;ITE062&lt;/td&gt; &lt;td class="center" id="units6"&gt;3.0&lt;/td&gt; &lt;td id="prof6"&gt;Galudo, Darwin M.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite062"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="center" id="number7"&gt;7&lt;/td&gt; &lt;td id="subject7"&gt;Operating System&lt;/td&gt; &lt;td class="center" id="code7"&gt;ITE076&lt;/td&gt; &lt;td class="center" id="units7"&gt;3.0&lt;/td&gt; &lt;td id="prof7"&gt;Lagala, Glenn T.&lt;/td&gt; &lt;td style="text-align: center;"&gt;&lt;span id="ite076"&gt;5&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="combobox"&gt; &lt;span style="color: white;"&gt;Select a subject to reserve:&lt;/span&gt; &lt;select&gt; &lt;option&gt;&lt;/option&gt; &lt;option id="1" value="ITE164"&gt;Data Comm. Systems &amp; Networking (ITE164)&lt;/option&gt; &lt;option id="2" value="PHI001"&gt;Introduction to Philosophy and Logic (PHI001)&lt;/option&gt; &lt;option id="3" value="ITE165"&gt;Basic Finance &amp; Acctg. Principles for IT (ITE165)&lt;/option&gt; &lt;option id="4" value="ITE048"&gt;Discrete Structures (ITE048)&lt;/option&gt; &lt;option id="5" value="ITE136"&gt;Web Page Design (ITE136)&lt;/option&gt; &lt;option id="6" value="ITE062"&gt;Systems Analysis and Design (ITE062)&lt;/option&gt; &lt;option id="7" value="ITE076"&gt;Operating System (ITE076)&lt;/option&gt; &lt;/select&gt; &lt;a href="javascript:reduceSlot1(1)" id="button1"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot2(1)" id="button2"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot3(1)" id="button3"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot4(1)" id="button4"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot5(1)" id="button5"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot6(1)" id="button6"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;a href="javascript:reduceSlot7(1)" id="button7"&gt;&lt;input type="button" value="Reserve"&gt;&lt;/a&gt; &lt;/div&gt; &lt;body&gt; </code></pre> <p>I need your help :( i'm still a newbie</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload