[英]How to show my javascript counter result in 2 divs on the same page?
[英]How to bind JavaScript result to a div on my page?
我有一個Java腳本文件,它的輸出是帶有一些信息的表。 我想在頁面的我的一個DIV中顯示此結果,但是將函數的結果放在頁面標題的頂部! 我該怎么做才能解決此問題?
這是我的Java腳本文件的末尾,實際上這是它的輸出'document.write(“”)document.write(“ document.write(”“)document.write(”“)document.write(”“)文檔.write(“。write(”)
اوقاتبهافق:
انتخابشهراراکاردبیلارومیهاصفهاناهوازایلامبجنوردبندرعباسبوشهربیرجندتبریزتهرانخرمآبادرشتزاهدانزنجانساریسمنانسنندجشهرکردشیرازقزوینقمکرمانکرمانشاهگرگانمشهدهمدانیاسوجیزد
“)document.write(”“)”,這是它在我的母版頁“”中的調用
$(document).ready(function ogh() {
var CurrentDate = new Date();
var JAT = 1;
function pz() { };
init(); document.getElementById("cities").selectedIndex = 12;
coord(); main();
});
$(document).ready(function () {
$("#oghatSharii").append(ogh());
});
</script>
</form>
'如果您無法理解我的代碼的頂部,則其輸出為表格
您可以在ready事件中使用jquery設置div的HTML,如下所示:
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
....
<script type="text/javascript">
$(document).ready(function () {
$("#myDiv").append(pz());
});
function pz() {
// do here something useful and return the text you want to add to the div
return "Hello there =) !!!";
};
</script>
<div id="myDiv"></div>
不要忘記安裝jQuery:
我用這個
function ogh()
{
var CurrentDate = new Date();
var JAT = 1;
function pz() { };
init(); document.getElementById("cities").selectedIndex = 12;
coord(); main();
}
$(document).ready(function () {
$("#oghatSharii").append(ogh());
});
但是我遇到一個錯誤:我的一個功能無法訪問oits數據
一些步驟
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.