This article assumes you have a basic understanding of browser F12 tools, bookmarks, and Tampermonkey. If you have questions, please leave a comment.
Background At the end of every term, the educational administration system requires filling out satisfaction questionnaires for several course teachers. Common system restrictions:
- All indicators for each teacher cannot be completely identical—there must be 1 item that is different.
- The rating control is in the form of
html <select name="DataGrid1$ctl02$JS1">…</select>ASP.NET mixes row and column numbers intoname / id. - The number of columns (teachers) may be ≥ 1, and column numbers can be
JS1or written as lowercasejs1.
Goal
For each teacher: Keep only 1 indicator as
A(or any diffVal you want), and the rest asB(defaultVal); Never select too many, never select too few.
0. Quick Start
- Save the entire line as a Bookmark (Bookmarklet).
- Open the evaluation page → Click the bookmark → Finished within three seconds.
The following text will break down the script logic in detail and provide two alternative usage methods: one-time console execution and Tampermonkey automation.
1. Core Principles
| Step | Key Point | Explanation |
|---|---|---|
| Element Positioning | querySelectorAll('select[id^="DataGrid1_"], select[name^="DataGrid1$"]') | ASP.NET writes double copies of id and name; choosing one covers the vast majority of school systems. |
| Teacher Grouping | Regex capture JS\d+ / js\d+ | Columnar layout: same column means same teacher, just need to identify the column number. Solves mixed case writing via toUpperCase(). |
| Batch Assignment | defaultVal full coverage → Randomly pick 1 item to change to diffVal | First rate same level, then rate different level, ensuring neatness. |
| Secondary Validation | filter(sel => sel.value === diffVal) | If manual user changes cause multiple As in a column, the script automatically changes the extras back to the default score. |
| Event Triggering | change + input + blur | Old educational systems often listen to one of these; dispatch all at once to ensure "manual operation" traces. |
| iframe Recursion | document.querySelectorAll("iframe") | Some systems embed the rating table in a sub-frame; recursive traversal ensures 100% coverage. |
In a nutshell: The script is—Position → Group → Cover → Rate Differently → Validate Rating → Notify.
2. Three Usage Methods
2.1 Console Temporary Script
- Enter the evaluation page, scroll to the bottom to ensure all controls are loaded.
F12 → Console, paste the full script below, press Enter.- After
✅pops up, click "Submit" directly.
2.2 Bookmarklet (Bookmark)
- Create a new item in the browser bookmark bar, name it arbitrarily "One-Click Evaluation".
- Paste the entire javascript: line from the Quick Start paragraph into the URL.
- Enter evaluation page later → Click bookmark → Automatically finished.
Pros: Cross-browser, no extensions; Cons: Still need to click once manually.
2.3 Tampermonkey / Violentmonkey Auto Script
- Install Tampermonkey (Chrome / Edge), Violentmonkey (Firefox), etc.
- Create a new script, paste the full version in; change
@matchto your school's evaluation URL. - Save.
- Visit the webpage later, the script executes automatically, no operation needed.
3. Custom Evaluation Grades
| Requirement | Modification |
|---|---|
| Want to give mostly A, 1 C per column | defaultVal="A"; diffVal="C" |
| Specify the 2nd row is always diffVal | Change set(col[Math.random()*…], diffVal) to set(col[1], diffVal) |
4. Summary
- Positioning:
querySelectorAllgrabs<select> - Grouping: Use
JS\d+ / js\d+column numbers to distinguish teachers - Assignment: Fill all default, then randomize 1 different
- Ensure Uniqueness: Pay attention to secondary validation and deduplication
- Compatibility: Case sensitivity, iframe, event triggering
- Three Usages: One-time paste / Bookmark / Tampermonkey
With this script, end-of-term evaluation no longer requires clicking one by one—one click, done in seconds.
References/Credits
- Universal Naming Convention for Educational Administration Systems (
DataGrid1$ctlXX$JSX) - MDN:
Element.dispatchEventusage - StackOverflow: How to trigger
change&inputevents simultaneously in JS