HTML DOM name ÊôÐÔ

¶¨ÒåºÍÓ÷¨

name ÊôÐÔ¿ÉÉèÖûò·µ»Ø´æ·Å´°¿ÚµÄÃû³ÆµÄÒ»¸ö×Ö·û´®¡£

¸ÃÃû³ÆÊÇÔÚ open() ·½·¨´´½¨´°¿Úʱָ¶¨µÄ»òÕßʹÓÃÒ»¸ö <frame> ±ê¼ÇµÄ name ÊôÐÔÖ¸¶¨µÄ¡£

´°¿ÚµÄÃû³Æ¿ÉÒÔÓÃ×÷Ò»¸ö <a> »òÕß <form> ±ê¼ÇµÄ target ÊôÐÔµÄÖµ¡£ÒÔÕâÖÖ·½Ê½Ê¹Óà target ÊôÐÔÉùÃ÷Á˳¬Á´½ÓÎĵµ»ò±íµ¥Ìá½»½á¹ûÓ¦¸ÃÏÔʾÓÚÖ¸¶¨µÄ´°¿Ú»ò¿ò¼ÜÖС£

Óï·¨

window.name=name

ʵÀý

ÏÂÃæµÄÀý×Ó¿É·µ»ØÐ´°¿ÚµÄÃû³Æ£º

<html>
<head>
<script type="text/javascript">
function checkWin()
  {
  document.write(myWindow.name)
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','MyName','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="What's the name of 'myWindow'?"
onclick="checkWin()">

</body>
</html>
VUE