1
我在javascript/jquery中有兩個腳本。我將如何結合在一起。在身體負荷此功能運行在jQuery/javascript中合併兩個腳本
<script type="text/javascript">
window.onload=function() {
var tId = setInterval(function() {
document.getElementById("link1").disabled=!navigator.onLine;
},250);
</script>
<script>
var status = navigator.onLine;
if (status) {
$("#link1").removeClass('diconnected').addClass('connected');
$("#link1").data('disabled',true);
} else {
$("#link1").removeClass('connected').addClass('diconnected');
}
}
</script>
您是否嘗試過什麼後放右括號}? Stackoverflow不是一個自動免費的在線怪異代碼合併工具 – zerkms
你是否已經開始使用顯而易見的方法,並且從中間刪除了'
你的第一個腳本缺少一個右括號}
如果在添加}您可以刪除關閉和開啓腳本標記。
此外,你可能想的在window.onload函數內代碼的第二位,這意味着你可以在第二個腳本代碼
來源
2014-03-13 22:35:02 Yan