自定义热键(请按a)
<SCRIPT language="JavaScript">
<!--
var hotkey=97
var destination=""
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
//-->
</SCRIPT>
下面的是用javascript传递参数。如果本文件为test.htm,如果访问 test.htm?12 则javascript会得到?后的值并用document.all替换iframe的src值。
<iframe height="750" width="760" scrolling="no" src="view.jsp" id="u" frameborder="0"></iframe>
<script language="javascript">
var url=window.location.href;
var s=url.indexOf("?");
if(s!=-1)
{
var src=url.substring(s+1);
document.all.u.src="view.jsp?id="+src;
}
</script>