, hvordan at fremhæve ord ved at trykke dem, og listen over de fremhævede ord anbringes i en skjult input i en form, < html >, < head >, < manuskript language = " javascript " og gt, <!-- Script hiding, function SortString(value) {, var valuearray = new Array();, , arraypos = 0;, valuearray[0] = '';, , for (x=0; x < value.length; x++) {, valuearray[arraypos] = valuearray[arraypos] + value.substring(x,x+1);, if (value.substring(x,x+1) == ',') valuearray[++arraypos] = '';, }, for (x=0; x < valuearray.length-1; x++) {, for (y= x+1; y < valuearray.length; y++) {, if (valuearray[y] < valuearray[x]) {, temp = valuearray[x];, valuearray[x] = valuearray[y];, valuearray[y] = temp;, }, }, }, , newvalue = '';, for (x=0; x < valuearray.length; x++) newvalue = newvalue + valuearray[x];, return newvalue;, }, function QuestionNumber(name) {, tempname = name.toUpperCase();, pos = tempname.indexOf('W',0);, if (pos < 0) {, alert('Error in question format, ' + name + ' is not valid.');, return -1;, }, return name.substring(0,pos);, }, function WordNumber(name) {, tempname = name.toUpperCase();, pos = tempname.indexOf('W',0);, if (pos < 0) {, alert('Error in question format, ' + name + ' is not valid.');, return -1;, }, return name.substring(pos,name.length);, }, function InsertItem(name) {, QNumber = QuestionNumber(name);, WNumber = Wordnumber (navn) + ', og', hvis ((qnumber!= - 1) & & (wnumber!= - 1)) (, tempstring = dokument udgør [0]. elementer [qnumber]. værdi, pos = tempstring. indexof (wnumber, 0), hvis (pos. < 0) dokument udgør [0]. elementer [qnumber]. værdi =, sortstring (tempstring + wnumber), }}, funktion removeitem (navn) (, qnumber = questionnumber (navn), wnumber = wordnumber (navn) + ', og', hvis ((qnumber!= - 1) & & (wnumber!= - 1)) (, tempstring = dokument udgør [0]. elementer [qnumber]. værdi, pos = tempstring. indexof (wnumber, 0), hvis (pos. > = 0) (, dokument udgør [0]. elementer [qnumber]. værdi = tempstring. substring (0, pos) + tempstring. substring (pos + wnumber.length, tempstring. længde), }, }}, funktion greb (highlightcolor) {, kilde = begivenhed. srcelement; //evaluering (' hvis (type (' + source.name + ' isselected) = = " udefinerede ") ' + source.name + ' isselected = 0 '); //evaluering (' isselected =!' + source.name + ' isselected '); //evaluering (source.name + ' isselected = isselected '), , isselected = (source.color = = highlightcolor), hvis (!isselected) {, source.color = HighlightColor;, InsertItem(source.name);, }, else {, source.color = document.body.text;, RemoveItem(source.name);, }, //Now de-select, txt = document.body.createTextRange();, txt.move("character",1);, txt.select();, , }, //End of script hiding -->, </Script>, </head>, <body>, <form name = 'fred' action = '/'>, Please select all the verbs in the following sentence, (Click each word to select/deselect), <p OnMouseOver="this.style.cursor='hand';" OnMouseOut="this.style.cursor='auto';">, <font name="q1w1" onclick="Toggle('#ff0000');">The</font>, <font name="q1w2" onclick="Toggle('#ff0000');">cat</font>, <font name="q1w3" onclick="Toggle('#ff0000');">sat</font>, <font name="q1w4" onclick="Toggle('#ff0000');">on</font>, <font name="q1w5" onclick="Toggle('#ff0000');">the</font>, <font name="q1w6" onclick="Toggle('#ff0000');">mat</font>, <input name = 'q1' value=''>, </form>, </body>, </html>,
fremhæve ord ved at trykke dem
Previous:print en anden side