在我网站的测试页面中,这个 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
任何帮助都会很棒。谢谢!