vendredi 2 janvier 2015

Passing parameters from one HTML page to another


I've 2 pages; notes.html and symptoms.html. In symptoms.html, I've got some sort of rating system. Suppose that user selects 1 out of 0 to 2 scale, then it should be passed to calendar.html. I've at least 10 such ratings in symptoms page.


Code for symptoms page:



<div style="position: absolute; top: 10px; left: 23px;">Acne:</div>

<div class="starbox ghosting autoupdate" style="position: absolute; right: 16px; top: 3px;" id="acne"></div>

<div style="position: absolute; top: 42px; left: 23px;">Backaches:</div>

<div class="starbox ghosting autoupdate" style="position: absolute; right: 16px; top: 38px;" id="back"></div>
<script>
function saveSymptoms() {
var a = document.getElementById("acne");
var b = document.getElementById("back");
switch (classname = starbox ghosting autoupdate) {
case 0:
var one = low;
break;
case 1:
var two = medium;
break;
case 2:
var three = high;
break;
}
var url = "notes.html?Agne=" + a,
"back=" + b;
window.location.href = url;
console.log(url);
document.getElementById("myButton").onclick = function() {
location.href = "notes.html";
}
}
</script>


Problem faced: The parameters aren't getting passed to the url when clicked on save button.


Expected Result: The output should be something like this: file:///C:/Users/AjayKumar/TizenWorkspace/PTracker/notes.html?acne=low;back=high


My Result: I'm getting this: file:///C:/Users/AjayKumar/TizenWorkspace/PTracker/notes.html?acne=;back=





Aucun commentaire:

Enregistrer un commentaire