function createajax()
{
var _xmlhttp
try
{
_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e){
try
{
_xmlhttp=new XMLhttprequest()
}
catch(e){
_xmlhttp=false
}
}
return _xmlhttp
}
function scontent(pages,title){
var title=title
var pages=pages
var content=document.getElementById(title);
var xmlhttp=createajax();
if (xmlhttp) {
xmlhttp.open('get',pages+Math.random(),true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
setInnerHTML(content,unescape(xmlhttp.responseText))
}
else {
content.innerHTML='<font color=#ffoooo>正在載入中......</font>';
}
}
xmlhttp.send(null);
}
}
var setInnerHTML = function (el, htmlCode) {
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('msie') >= 0 && ua.indexOf('opera') < 0) {
htmlCode = '<div style="display:none">for IE</div>' + htmlCode;
htmlCode = htmlCode.replace(/<script([^>]*)>/gi,
'<script$1 defer>');
el.innerHTML = htmlCode;
el.removeChild(el.firstChild);
} else {
var el_next = el.nextSibling;
var el_parent = el.parentNode;
el_parent.removeChild(el);
el.innerHTML = htmlCode;
if (el_next) {
el_parent.insertBefore(el, el_next)
} else {
el_parent.appendChild(el);
}
}
}