function getRandomPage() {
	xmlRandomhttp = createRandomXMLHttp();
	if (xmlRandomhttp) {
		xmlRandomhttp.onreadystatechange = setRandomData;
		xmlRandomhttp.open('GET', 'toppage.php');
		xmlRandomhttp.send(null);
	} else {
		alert("XMLHttpRequest失敗");
	}
}

function setRandomData() {
	if (xmlRandomhttp.readyState == 4 && xmlRandomhttp.status == 200) {
		document.getElementById("random").innerHTML = xmlRandomhttp.responseText;
	}
}

// XMLHttpsオブジェクト作成
function createRandomXMLHttp() {
	try {
		return new ActiveXObject ("Microsoft.XMLHTTP");
	}catch(e){
		try {
			return new XMLHttpRequest();
		}catch(e) {
			return null;
		}
	}
	return null;
}

document.write('<div id="random"></div>');

getRandomPage()

