私のサイトのテストページでは、このテキストを変更するjsのビットは問題なく機能しますが、実際のサイトに持ち込むと、下部のリンクはどれも機能しません。
完全に実装されたアイデアは、ページの下部にナビゲーションバーを配置して、ページコンテンツのHTMLコードを生成することです。実際のコンテンツ自体は、必要になるまでjavascript文字列内に隠されています。次に、ページ上の所定の位置に配置されます。
<html>
<head>
<title>Javascript Test #9</title>
<script type="text/javascript">
window.onload = function() {
document.getElementById("workl").onclick=workf;
document.getElementById("aboutl").onclick=aboutf;
document.getElementById("contactl").onclick=contactf;
document.getElementById("quote").onclick=quotationf;
}
function workf(){
document.getElementById("para").innerHTML="Primary Changed Paragraph Content";
quotationf("changed quote content");
return false;
}
function aboutf(){
document.getElementById("para").innerHTML="Secondary Changed Paragraph Content<br><br><br>";
quotationf("changed quote content");
return false;
}
function contactf(){
document.getElementById("para").innerHTML="Tertiary Changed Paragraph Content";
quotationf("changed quote content");
return false;
}
function quotationf (input){
document.getElementById("quote").innerHTML=input;
return false;
}
</script>
</head>
<body>
<p id="quote"> quote content</p>
<p id="para">Unchanged Paragraph Content</p> <br>
<a id="workl" href="#"> Click here to change the paragraph content </a><br>
<a id="aboutl" href="#"> Click here to change the paragraph content </a><br>
<a id="contactl" href="#"> Click here to change the paragraph content </a>
</body>
</html>
動作しないコードはここにあります:http://theblankframe.com/tempmobile/index.html
動作テストはここにあります:http://theblankframe.com/tempmobile/test2.html
どんな助けでも素晴らしいでしょう。ありがとう!