52 lines
1.3 KiB
HTML
52 lines
1.3 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="en">
|
||
|
|
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8" />
|
||
|
|
<title>POST DEMO</title>
|
||
|
|
</head>
|
||
|
|
|
||
|
|
<body>
|
||
|
|
<form id="my-form" action="/range_vote" method="post" oninput=UpdateValues(event)>
|
||
|
|
This page is an experiment in voting. Half of the people who visit this site vote using Plurality Voting
|
||
|
|
where a voter selects their top candidate, and the winner is the candidate with the most votes. The other
|
||
|
|
half use Range Voting where voters score all familiar candidates based on how happy they would be should
|
||
|
|
that candidate win. You have been randomly selected to vote using Range Voting.
|
||
|
|
<br>
|
||
|
|
<br>
|
||
|
|
|
||
|
|
<table>
|
||
|
|
<tr>
|
||
|
|
<th>Candidate</th>
|
||
|
|
<th><span id="spanid"> </th>
|
||
|
|
<th>Happiness</th>
|
||
|
|
</tr>
|
||
|
|
<!-- INJECT0 -->
|
||
|
|
</table>
|
||
|
|
|
||
|
|
<br>
|
||
|
|
<button type="submit" value="submit">Submit</button>
|
||
|
|
</form>
|
||
|
|
</body>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function CanId(c)
|
||
|
|
{
|
||
|
|
let w=c.split(" ");
|
||
|
|
let lastname=w[w.length-1].toLowerCase();
|
||
|
|
let id=lastname.split("-");
|
||
|
|
let rval=id[id.length-1];
|
||
|
|
return(rval);
|
||
|
|
}
|
||
|
|
|
||
|
|
function UpdateValues(event)
|
||
|
|
{
|
||
|
|
let id=event.srcElement.id;
|
||
|
|
console.log(id);
|
||
|
|
let slider=document.getElementById(id);
|
||
|
|
let output=document.getElementById('o-'+CanId(id));
|
||
|
|
if (slider.value==-1) output.innerHTML="No Opinion";
|
||
|
|
else output.innerHTML=slider.value+"%";
|
||
|
|
}
|
||
|
|
</script>
|