翻译 名词 dom 获取

翻译 名词 dom 获取

open.qingxun.com/filecore.html#page11
https://open.qingxun.com/filecore.html#page11
添加链接描述

文档:翻译 名词 dom 获取.note
链接:http://note.youdao.com/noteshare?id=38f3151e3dee401bff9c49c97e4d2c55&sub=E4B2E7E67B334FA2ABE0E16B74642FB1
添加链接描述

   // """ 或 auto" : """ 或 auto",
"zh" : "zh",
"jp" : "jp",
"th" : "th",
"fra" : "fra",
"en" : "en",
"spa" : "spa",
"kor" : "kor",
"tr" : "tr",
"vie" : "vie",
"ms" : "ms",
"de" : "de",
"ru" : "ru",
"ara" : "ara",
"est" : "est",
"be" : "be",
"bul" : "bul",
"hi" : "hi",
"is" : "is",
"tl" : "tl",
"fin" : "fin",
"nl" : "nl",
"ca" : "ca",
"cs" : "cs",
"hr" : "hr",
"lv" : "lv",
"lt" : "lt",
"rom" : "rom",
"no" : "no",
"pt" : "pt",
"swe" : "swe",
"sr" : "sr",
"eo" : "eo",
"sk" : "sk",
"slo" : "slo",
"sw" : "sw",
"uk" : "uk",
"iw" : "iw",
"el" : "el",
"hu" : "hu",
"hy" : "hy",
"it" : "it",
"id" : "id",
"sq" : "sq",
"am" : "am",
"az" : "az",
"eu" : "eu",
"bn" : "bn",
"bs" : "bs",
"gl" : "gl",
"ka" : "ka",
"gu" : "gu",
"ig" : "ig",
"ga" : "ga",
"zu" : "zu",
"kn" : "kn",
"kk" : "kk",
"ky" : "ky",
"lb" : "lb",
"mk" : "mk",
"mt" : "mt",
"mi" : "mi",
"mr" : "mr",
"ne" : "ne",
"pa" : "pa",
"si" : "si",
"ta" : "ta",
"te" : "te",
"ur" : "ur",
"uz" : "uz",
"cy" : "cy",
"yo" : "yo",
"cht" : "cht",


function downloadTxt(filename, text) {
    var pom = document.createElement('a');
    pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
    pom.setAttribute('download', filename);
    if (document.createEvent) {
        var event = document.createEvent('MouseEvents');
        event.initEvent('click', true, true);
        pom.dispatchEvent(event);
    } else {
        pom.click();
    }
}

let  page11Dom=
document.getElementById('page11')
let tableDom=
page11Dom.getElementsByClassName('my-table table-bordered')[0]

let bodyDom=
tableDom.getElementsByTagName('tbody')[0]

let tableRows=

bodyDom.getElementsByTagName('tr')
let kRows=""
for(let i=0;i<tableRows.length;i++){
    // let tableCells=
    // tableRows[i]

    let tableRow=
    tableRows[i]

    let tableCells=
    tableRow.getElementsByTagName('td')

    let engName= tableCells[0].textContent.trim()
    // console.log(engName);

    // let kRow=  `"${engName}" = "${engName}";`
    let kRow=  `"${engName}" : "${engName}",`

    console.log(kRow);
    kRows+=kRow+"\n"
}

downloadTxt("k.ts",kRows)


// bodyDom.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].innerHTML='1'


你可能感兴趣的:(前端,json)