来源:www.cncfan.com | 2006-5-5 | (有4433人读过)
实现诸如go.htm?u=url这样的转换过程,代码如下。
function get_url() { var src = window.location.href; var I = src.substr(src.indexOf("?u=") + 3).length; var T = src.indexOf("?u="); //alert(src); if (0 >= T) return ""; if (I == src.length) return -1; var url = src.substr(src.indexOf("?u=") + 3); //alert(url); return url; }
<SCRIPT LANGUAGE="JavaScript"> <!-- function get_url() { var src = window.location.href; var I = src.substr(src.indexOf("?u=") + 3).length; var T = src.indexOf("?u="); //alert(src); if (0 >= T) return ""; if (I == src.length) return -1; var url = src.substr(src.indexOf("?u=") + 3); return url; }
function go(url) { document.write('<html>'); document.write('<head>'); document.write('<title>title font - ' + url + '</title>'); document.write('<meta http-equiv="Content-Type" content="text/html; charset=gb2312">'); document.write('</head>');
document.write('<frameset rows="25,*" frameborder="NO" border="0" frameborder="0" framespacing="0"> '); document.write(' <frame scrolling="NO" noresize src="head.htm?u=' + url + '" >'); document.write(' <frame name="www.cncfan.com" src="' + url + '">'); document.write('</frameset>'); document.write('</html>'); }
go(get_url());
//--> </SCRIPT> (原创:www.cncfan.com。转载请注明来源,谢谢。)
|