<script type="text/javascript">
var mychar= function(id){ return document.getElementById(id).innerHTML;}; ;
document.write("結果:"+mychar("con")); //輸出獲取的P標簽。
</script>
var mychar= function(id){ return document.getElementById(id).innerHTML;}; ;
document.write("結果:"+mychar("con")); //輸出獲取的P標簽。
</script>
2016-04-18
<script type="text/javascript">
document.write("開啟JS之旅!");
</script>
document.write("開啟JS之旅!");
</script>
2016-04-18
照理說函數建立后是不能自動執行的,需要調用。那么這里的函數為什么沒有被調用就生效了?
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
?
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
?
2016-04-18
這樣不能過我不服
var add2= contxt() //定義函數
{
alert("哈哈,調用函數了!");
}
var add2= contxt() //定義函數
{
alert("哈哈,調用函數了!");
}
2016-04-17