参考一下我写的这段代码(此代码是和一个注册表文件合起来用的):<html> <body> <script language="javascript"> var oDoc=external.menuArguments.document; var sStr="<center><p>"; for(var i=0;i<oDoc.all.length-1;i++){ if(oDoc.all(i).tagName=="A"){ sStr+="<A href=\"" + oDoc.all(i) + "\">" + oDoc.all(i).innerText +"</A><br>\n"; } } sStr+="</p></center><hr><center>If you don't like this style, you can change the file:<br>"+document.location.pathname;+"</center>" oDoc.writeln(sStr); </script> </body> </html>注册表文件为: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\&My menu] @="C:\\my_menu.htm" "Contexts"=dword:000000f3
<script>
document.write(document.all.tags("A")["abc"].href);
</script>
2
<script>
document.write(document.all.abc.href);
</script>
var links=document.all.tags("A")
<body>
<script language="javascript">
var oDoc=external.menuArguments.document;
var sStr="<center><p>";
for(var i=0;i<oDoc.all.length-1;i++){
if(oDoc.all(i).tagName=="A"){
sStr+="<A href=\"" + oDoc.all(i) + "\">" + oDoc.all(i).innerText +"</A><br>\n";
}
}
sStr+="</p></center><hr><center>If you don't like this style, you can change the file:<br>"+document.location.pathname;+"</center>"
oDoc.writeln(sStr);
</script>
</body>
</html>注册表文件为:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt]
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\&My menu]
@="C:\\my_menu.htm" "Contexts"=dword:000000f3