简体   繁体   中英

Why doesn't the javascript output anything?

Why doesn't the javascript output anything? It should output some html code.

<html>
<head>
<script type="text/javascript"><!--`

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function d64(input) {
    var output = new StringMaker();
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;

    // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

    while (i < input.length) {
        enc1 = keyStr.indexOf(input.charAt(i++));
        enc2 = keyStr.indexOf(input.charAt(i++));
        enc3 = keyStr.indexOf(input.charAt(i++));
        enc4 = keyStr.indexOf(input.charAt(i++));

        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;

        output.append(String.fromCharCode(chr1));

        if (enc3 != 64) {
            output.append(String.fromCharCode(chr2));
        }
        if (enc4 != 64) {
            output.append(String.fromCharCode(chr3));
        }
    }

    return output.toString();
}

//-->
</script>

</head>
<body>
blah
<script type="text/javascript">document.write(d64("PGEgaHJlZj0ibWFpbHRvOnN0ZXZlbkBtYWlsaW5hdG9yLmNvbSI+c3RldmVuQG1haWxpbmF0b3IuY29tPC9hPg=="));</script><noscript>steven[|at|]mailinator[|dot|]com</noscript>
blah
@
@
@
@
@
@
@
@
@@@@@22</body>
</html>

StringMaker is not defined:

function d64(input) {
    var output = new StringMaker(); //<= what's this?
    ...
}

I am getting a javascript error. StringMaker is undefined. But StringMaker relates to Java ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM