Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
HTML
<!DOCTYPE html>

  
  <h1>  Question 1 </h1>
    
    <meta charset="utf-8">
    <title>
    
    table {
    border-collapse: collapse;
    border-spacing: 0px;
    background-repeat: no-repeat;

      }
      body {
      background-color: #FAF0E6;
      }
      /* remove padding */
    td, th {
      padding: 0;
      width: 120px; height: 160px;
      }
    div {
      box-sizing: border-box;
      -moz-box-sizing: border-box;
      -webkit-box-sizing: border-box;
      border: 1px solid #CCCCCC;
      width: 120px; height: 160px; background: #FFFFFF;
      }
    
  
  
    
      
        
        
        
        
      
      
        
        
        
        
      
      
        
        
        
        
      
    <table><tbody><tr><td id="t1">
          <div id="d1"></div>
        </td><td id="t2">
          <div id="d2"></div>
        </td><td id="t3">
          <div id="d3"></div>
        </td><td id="t4">
          <div id="d4"></div>
        </td></tr><tr><td id="t5">
          <div id="d5"></div>
        </td><td id="t6">
          <div id="d6"></div>
        </td><td id="t7">
          <div id="d7"></div>
        </td><td id="t8">
          <div id="d8"></div>
        </td></tr><tr><td id="t9">
          <div id="d9"></div>
        </td><td id="t10">
          <div id="d10"></div>
        </td><td id="t11">
          <div id="d11"></div>
        </td><td id="t12">
          <div id="d12"></div>
        </td></tr></tbody></table>
    <h1></h1>

<ul>
<p>1. Which TV show is this ? </p>
Peaky Blinders<br>
Westworld<br>
Humans<br>
The 100<br>
</ul>

See question 2

    
  





function modify_qty(val) {
    var qty = document.getElementById('counter').value;
    var new_qty = parseInt(qty,10) + val;
    if (new_qty &lt; 0) {
        new_qty = 0;
    }
    document.getElementById('counter').value = new_qty;
    return new_qty;

    }


$("#tx").click(function(){           

  if ($("#dx").is(":visible")) {  
      modify_qty(-1);               
  }
  $("#dx").hide();                   
});

$("#t1").click(function(){
  if ($("#d1").is(":visible")) {
      modify_qty(-1);
  }
  $("#d1").hide();
});
$("#t2").click(function(){
  if ($("#d2").is(":visible")) {
      modify_qty(-1);
  }
  $("#d2").hide();
});
$("#t3").click(function(){
  if ($("#d3").is(":visible")) {
      modify_qty(-1);
  }
  $("#d3").hide();
});
$("#t4").click(function(){
  if ($("#d4").is(":visible")) {
      modify_qty(-1);
  }
  $("#d4").hide();
});
$("#t5").click(function(){
  if ($("#d5").is(":visible")) {
      modify_qty(-1);
  }
  $("#d5").hide();
});
$("#t6").click(function(){
  if ($("#d6").is(":visible")) {
      modify_qty(-1);
  }
  $("#d6").hide();
});
$("#t7").click(function(){
  if ($("#d7").is(":visible")) {
      modify_qty(-1);
  }
  $("#d7").hide();
});
$("#t8").click(function(){
  if ($("#d8").is(":visible")) {
      modify_qty(-1);
  }
  $("#d8").hide();
});
$("#t9").click(function(){
  if ($("#d9").is(":visible")) {
      modify_qty(-1);
  }
  $("#d9").hide();
});
$("#t10").click(function(){
  if ($("#d10").is(":visible")) {
      modify_qty(-1);
  }
  $("#d10").hide();
});
$("#t11").click(function(){
  if ($("#d11").is(":visible")) {
      modify_qty(-1);
  }
  $("#d11").hide();
});
$("#t12").click(function(){
  if ($("#d12").is(":visible")) {
      modify_qty(-1);
  }
  $("#d12").hide();
});


What I have tried:

Every time the user click on the picture, value of the counter decreases, but I cannot call the same value in my another HTML page it starts from 12 again. For example when the user clicks on the picture 2 times, counter will be 10. I wanna want to see 10 in my another HTML quiz page. Is there any way to do it?
Posted
Updated 13-Apr-17 4:42am
v2
Comments
Karthik_Mahalingam 11-Apr-17 10:24am    
pass the value in query string.

1 solution

for(var i=1 ; i <12 ; i++){

var return += "<td> <a href='other_page.html?id="+res.rows.item(i).id_titulo+"'>"+res.rows.item(i).id+"</td>";


}
 
Share this answer
 
v3
Comments
MarkNopfler 13-Apr-17 10:47am    
Maybe it work to you. I hope that It work.

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