CSDN Forum technical Area Average giving function _javascript skill

Source: Internet
Author: User
1 average score per person (repeat only once):
Javascript:var t=function (tag,s) {return (s | | Document). getElementsByTagName (tag); var n=function (name) {return Document.getelementsbyname (name)};var total=t ("var") [0].innerhtml-0;var scores=n ("Tb_ Score "); var lz=t (" A ", T (" var ") [0].parentnode) [0].innerhtml;var c={};c[lz]=lz;for (var i=0;i<scores.length;i++) { var v=t ("A", Scores[i].parentnode) [0].innerhtml;if (!c[v]) {c[v]=v;scores[i].value=scores[i].value-0+1;total--;if ( total==0) break; if (i==scores.length-1) {i=-1;c={};c[lz]=lz;}}; Alert ("OK"); void (0)

Source:
Copy Code code as follows:

var t=function (tag,s)     {return (s | | Document). getElementsByTagName (tag);
var n=function (name) {return document.getelementsbyname (name)};
var total=t ("var") [0].innerhtml-0;
var scores=n ("Tb_score");
var lz=t ("A", T ("var") [0].parentnode) [0].innerhtml;
var c={};
C[lz]=lz;
for (var i=0;i<scores.length;i++) {    
    var v=t ("a", scores[i ].parentnode) [0].innerhtml;
    if (!c[v]) {
        c[v]=v;
        scores[i].value=scores[i].value-0+1;
        total--;
        if (total==0) break;
    }
    if (i==scores.length-1) {I=-1;c={};c[lz]=lz;}
};
Alert ("OK");

2 average score per floor:
Javascript:var t=function (tag,s) {return (s | | Document). getElementsByTagName (tag); var n=function (name) {return Document.getelementsbyname (name)};var total=t ("var") [0].innerhtml-0;var scores=n ("Tb_ Score "); var lz=t (" A ", T (" var ") [0].parentnode) [0].innerhtml;for (Var i=0;i<scores.length;i++) {if (T (" a ", Scores[i] . parentnode) [0].innerhtml!=lz) {scores[i].value=scores[i].value-0+1;total--;if (total==0) break;} if (i==scores.length-1) i=-1;}; Alert ("OK"); void (0)

Source:
Copy Code code as follows:

var t=function (tag,s) {return (s) | | Document). getElementsByTagName (tag);
var n=function (name) {return document.getelementsbyname (name)};
var total=t ("var") [0].innerhtml-0;
var scores=n ("Tb_score");
var lz=t ("A", T ("var") [0].parentnode) [0].innerhtml;
for (Var i=0;i<scores.length;i++) {
if (t ("a", Scores[i].parentnode) [0].innerhtml!=lz) {
scores[i].value=scores[i].value-0+1;
total--;
if (total==0) break;
}
if (i==scores.length-1) i=-1;
};
Alert ("OK");

Description: Put the above code into the address of the page of the node in the bar to enter the OK, only once, otherwise there will be negative points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.