私はPHPを使用しています(HTML & jQuery)。 &「otherFile.notSureWhatExt」私は「index.htmlを」にコードを壊したく、これは私のオリジナルの作業「のindex.html」であるjavascriptとhtmlを複数のファイルに分割する方法
<script type="text/javascript" src="jquery.js"></script>
<script>
var p1 = "This is part 1";
var p2 = "This is part 2";
$(document).ready(function(){
alert(p1);
$('#content').html(p2);
});
</script>
<div id="content"></div>
<div id="content2">Hello</div>
を言うことができますが、彼らは同じファイルであるかのように働いています。
のindex.html:
<script type="text/javascript" src="jquery.js"></script>
<script type="notSureWhatType" src="otherFile.notSureWhatExt"></script>
<script>
var p1 = "This is part 1";
$(document).ready(function(){
alert(p1);
});
</script>
<div id="content"></div>
otherFile.notSureWhatExt:
JSPを使用して<script>
var p2 = "This is part 2";
$(document).ready(function(){
$('#content').html(p2);
});
</script>
<div id="content2">Hello</div>
、私は単純にファイル= "otherFile.anyCustomExtAlsoWorks" %>を含める<%の@を使用することができます。しかしここで私は今ではありません。私が望むのは、index.htmlを呼び出すときです。メッセージボックス "This is part 1"と、 "これはパート2です" & "Hello"というボトムの2 divを見ることができます。
ヒントありがとう。 – Coisox