-1

特定のディレクトリには、html ファイルのリストが含まれています。JavaScript を使用してリンクをクリックして、特定のディレクトリから html ファイルを開くにはどうすればよいですか?

4

1 に答える 1

2

提案されたように、これは同じウィンドウで新しいhtmlを開きます

<a href="other_directory/no_js_needed.html">Link</a>

これにより、新しいウィンドウでhtmlが開きます

<a href="other_directory/no_js_needed.html" target="_blank">Link</a>

javascriptインラインウェイ同じウィンドウ

<a href="other_directory/no_js_needed.html" onclick="location.href=this.href;return false">Link</a>

javascript インライン 新しいウィンドウ

<a href="other_directory/no_js_needed.html" onclick="window.open(this.href);return false">Link</a>

スクリプト タグ関数の JavaScript

<script>
function openlink(link){
location.href=link;
}
openlink('other_directory/no_js_needed.html');
</script>

新しいウィンドウの script タグ関数内の JavaScript

<script>
function openinnewwindow(link){
window.open(link)
}
openinnewwindow('other_directory/no_js_needed.html');
</script>
于 2013-06-07T06:06:36.000 に答える