Skip to content

Instantly share code, notes, and snippets.

@gaga5lala
Created June 28, 2015 08:29
Show Gist options
  • Save gaga5lala/261d6dc04228b6cadf95 to your computer and use it in GitHub Desktop.
Save gaga5lala/261d6dc04228b6cadf95 to your computer and use it in GitHub Desktop.
NSYSU 課程組離校問卷
// year + department
// X1032 + B402
var department = 'X1032B402';
var start = 101;
var end = 2000;
var className;
var row;
// department rate
for (row = start; row <= end; row++) {
className = department + row;
var btn_radio = document.getElementsByName(className);
// prevent input type = text
var rate = Math.floor(Math.random()*7)
if (btn_radio.length > 1) {
btn_radio[rate].checked = true;
}
}
// teacher rate
for (row = 1; row <= 100; row++) {
className = 'Q' + row;
var btn_radio = document.getElementsByName(className);
if (btn_radio.length > 0) {
// 0 ~ 5
btn_radio[1].checked = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment