Error with redirect in JavaScript

0

I would like that when the answer is correct when I click it will take me to another page and not to the result as it takes me now. Thanks

<div id="main-content" class="container main-content oregon-pd-unit" style="width: 1025px;height:200%; padding-bottom: 3%;">{seog:disable}



<style>
#div1{ 
  height: 250px;
  width: 420px; 
  float:left;

}
#div2{ 
  height: 250px;
  width: 420px; 
  float:left;

}
 #drag1, #drag2, #drag3, #drag4, #drag5{
    width: 100px;
    margin: -10px;
    height: 100px;
  }


.noBorder {
    border:none !important;
}


div1 {
background-image: url("images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/6v1.png");
}
div2{
    background-color: red;
}
table {
    border-collapse: collapse;
}

/* remove padding */
tr, td {
    padding: 0;
    border:0px;
}

</style>

<script src="/oregon/templates/oregon/js/html2canvas.js" type="text/javascript"></script>
<script type="text/javascript">
function demoFromHTML() {
    html2canvas(document.body, {
        onrendered: function(canvas) {
        var a=document.getElementById("table");
        canvas.setAttribute("id", "lala");  
        //a.appendChild(canvas);

        //var canvasl = document.getElementById('lala');
        //var dataURL = canvasl.toDataURL();      
        //document.getElementById('canvasImg').src = dataURL;     

      var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");  // here is the most important part because if you dont replace you will get a DOM 18 exception.


window.location.href=image; // it will save locally
        console.log("haha");
        console.log(window.location);
                  console.log("bili");

    }
    });
}

</script>



<script type="text/javascript">
var scores={};
var times=2;
var curTimes=0;
function allowDrop(ev) {
    ev.preventDefault();



}

function drag(ev) {
    ev.dataTransfer.setData("text", ev.target.id);    
    //console.log(ev.dataTransfer.getData("text"));
}
   //por de una respuesta correcta
  //var dic={"div1":["drag1","drag2"],"div2":["drag1","drag3"],"div3":["drag3"],"div4":[""]};

function drop(ev) {
    ev.preventDefault();
    var dic={"div1":["drag3","drag5"],"div2":["drag5","drag3"]};
    var datad = ev.dataTransfer.getData("text");

    if ( ev.target.nodeName !== "IMG" ) {
        ev.target.appendChild(document.getElementById(datad));
        var tmpTar=ev.target.id;
        if(tmpTar){curTimes+=1;}
        if(curTimes>=times){      
          document.getElementById("checkBtn").disabled = false;
    }

      if(dic[tmpTar].includes(datad)){
          scores[datad]=1;
        }else{
          scores[datad]=0;
        }
    }
}

</script>




<div style="    width: 1000px;  height: 680px;  background-size: 1000px 680px;    background-image: url('images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/6v1.png');    background-repeat: no-repeat;margin-left: auto;    margin-right: auto;">





<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><center>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"style="WIDTH: 90px; HEIGHT: 140px;POSITION:RELATIVE;LEFT:480PX;top:270px;"></div>


<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"style="WIDTH: 112px; HEIGHT: 125px;POSITION:RELATIVE;LEFT:540PX;top:270px;"></div>







 <div style="width: 90px;height: 150px;POSITION:RELATIVE;LEFT:170PX;top:-120px;">
<img id="drag3" draggable="true" ondragstart="drag(event)" alt="Picture of a battery" class="" src="images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/battery.png" style="width: 100px; height:134px; margin-top: 5px;" /></div>


<div style="width: 90px;height: 150px;POSITION:RELATIVE;LEFT:420PX;top:-270px;">
<img id="drag5" draggable="true" ondragstart="drag(event)" alt="Picture of a light bulb that is not lit up" class="" src="images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/battery.png" style="width: 100px; height:134px; margin-top: 5px;" /></div>




<a href="index.php/component/content/article?id=3436" target="_self"><img alt="" src="images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/on.png
" class="imghover" style="width: 70px;POSITION:RELATIVE;LEFT:31PX;top:-95px;" /></a>


<img alt=""  src="images/EBSD_Images/EBSD_STAGE_2/EBSDS2L5/Circuit_Interactive/off.png" class="imghover" style="width: 70px;POSITION:RELATIVE;LEFT:51PX;top:-92px;" />








</div>
<br>
<center>
<font size="8" id="score" style="POSITION:RELATIVE;LEFT:10PX;top:-115px;border:;" ></font></center>
</div>
    
asked by Gabriel 21.03.2018 в 22:16
source

0 answers