サイトをご覧くださいtdsoft.se このページのスクリプトはopera、firefox chromeなどで動作し、「random_1」を出力しますインターネットエクスプローラでは、それが印刷されます( "未定義の定義済みの定義済みの定義済みの定義済みの定義済みの定義済みの定義済みの定義済み")、各文字の '未定義'です。私の質問は、あなたのうちの明るい人たちのうちの何人かが、この問題の答えを知っているかもしれないのでしょうか?Internet Explorerでは文字が「未定義」で他のブラウザでは文字が表示されない理由
EDIT_ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ ____
ここに1つのコード
<html>
<head>
<script language="javascript" type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var txt;
var buildName = "";
var xmlhttp;
/**
* Find a longest common subsenquence.
*
* Note: this is not necessarily the only possible longest common subsequence though!
*/
function lcs(listX, listY) {
return lcsBackTrack(
lcsLengths(listX, listY),
listX, listY,
listX.length, listY.length);
}
/**
* Iteratively memoize a matrix of longest common subsequence lengths.
*/
function lcsLengths(listX, listY) {
var lenX = listX.length;
var lenY = listY.length;
// Initialize a lenX+1 x lenY+1 matrix
var memo = [lenX+1];
for (var i = 0; i < lenX+1; i++) {
memo[i] = [lenY+1];
for (var j = 0; j < lenY+1; j++) {
memo[i][j] = 0;
}
}
// Memoize the lcs length at each position in the matrix
for (var i = 1; i < lenX+1; i++) {
for (var j = 1; j < lenY+1; j++) {
if (listX[i-1] == listY[j-1]) {
memo[i][j] = memo[i-1][j-1] + 1;
}
else {
memo[i][j] = Math.max(
memo[i][j-1],
memo[i-1][j]);
}
}
}
return memo;
}
/**
* Recursively read back a memoized matrix of longest common subsequence lengths
* to find a longest common subsequence.
*/
function lcsBackTrack(memo, listX, listY, posX, posY) {
// base case
if (posX == 0 || posY == 0) {
return "";
}
// matcth => go up and left
else if (listX [posX-1] == listY[posY-1]) {
return lcsBackTrack(memo, listX, listY, posX-1, posY-1) + listX[posX-1];
}
else {
// go up
if (memo[posX][posY-1] > memo[posX-1][posY]) {
return lcsBackTrack(memo, listX, listY, posX, posY-1);
}
// go left
else {
return lcsBackTrack(memo, listX, listY, posX-1, posY);
}
}
}
function loadXMLDoc(url,cfunc)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
function myFunction()
{
loadXMLDoc("http://tdsoft.se/testni.html",handleXML);
}
var checkState = function(xmlhttp, callback) {
try{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
callback();
}
else {
// Check back again 1 sec later
setTimeout(checkState, 1000);
}
}
catch(err){
setTimeout(checkState, 1000);
}
};
function handleXML()
{
checkState(xmlhttp, function() {
txt=xmlhttp.responseText;
buildName = "random_1";
var myvar = "";
txt = "" + txt;
var lcsString = lcs(txt, buildName);
document.write(lcsString);
});
}
</script>
</head>
<body onLoad="myFunction()">
</body>
</html>
バージョン(複数可)のInternet Explorerのを試してみましたか? –
@Ken私はIE8で再現できます – Rup
文字エンコードの問題のような音です。応答テキストと同じエンコードを使用してページが表示されていることを確認します。 –