日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

js动态创建元素之一--document.write

發(fā)布時間:2023/11/27 生活经验 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 js动态创建元素之一--document.write 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

以我曾經(jīng)寫過的例子舉例

如上圖,鄉(xiāng)鎮(zhèn)街道的名字和數(shù)目是根據(jù)數(shù)據(jù)庫的數(shù)據(jù)獲取的,有幾個鄉(xiāng)鎮(zhèn),就會顯示出來幾個,這就要求動態(tài)獲取鄉(xiāng)鎮(zhèn)名稱和數(shù)目,以下代碼中用到了document.write創(chuàng)建動態(tài)頁面,在利用document.write時,注意轉(zhuǎn)義字符\的運用,要不然容易報錯

<script language="JavaScript"type="text/javascript">
var uid=getQueryString("userId");//獲取用戶鏈接id
var str=xz_xmsl(uid);//獲取鄉(xiāng)鎮(zhèn)名字和數(shù)量的函數(shù) ?

var res=str.split('&');
document.write("<table style='margin:0 auto; margin-top:15px' width='920' border='0' cellspacing='0'>");
document.write("<caption align='left'>鄉(xiāng)鎮(zhèn)街道</caption>");
for (var i=1;i<=res.length;i++)
{

if((i%6)==1) ?//當(dāng)鄉(xiāng)鎮(zhèn)數(shù)目余1時開始創(chuàng)建列表
document.write("<tr>");

document.write("<td width='250' valign='top'>");
document.write("<ul class='left_li'>");
document.write("<li class='ico5' onClick=\"gotopage1(\'\',\'項目查詢\',\'"+res[i-1].split(',')[0]+"\',\'\')\">");//gotopage1是獲取鏈接地址的函數(shù),點擊某個鄉(xiāng)鎮(zhèn),就會跳轉(zhuǎn)到這個鄉(xiāng)鎮(zhèn)的具體信息
document.write("<div class='title'>"+res[i-1].split(',')[0]+ "</div>");
document.write("<div>"+res[i-1].split(',')[1]+ "</div>");
document.write("</ii>");
document.write("</ul>");
document.write("</td>");
if((i%6)==0||i==res.length) //當(dāng)項目數(shù)量余數(shù)0時或者等于總長時,開始換行
document.write("</tr>");
}
document.write("</table>");
</script>

?

函數(shù)xz_xmsl獲取鄉(xiāng)鎮(zhèn)名稱和數(shù)量

function xz_xmsl(USERID){
var USER_ID=USERID;
var str;
var inputValue=str+'|'+USER_ID;
var link=window.location.href.split('/');
var strUrl="http://"+link[2]+"/oa/extensions/PageEngine/StoredProcedureEngine.aspx?P_Name=TDZZ.PRO_TDZZ_XZ_XMSL&KeyValue="+inputValue+"&rand="+Math.random();//調(diào)用了存儲過程TDZZ.PRO_TDZZ_XZ_XMSL
str=GetXmlHttp(strUrl,"");
return str;
}

?

create or replace procedure PRO_TDZZ_XZ_XMSL(str out VARCHAR2 , USER_ID in VARCHAR2
??????????????????????????????????????????? ) is
???????? strresult VARCHAR2(2000);
??? --bmdm varchar2(20);
begin
strresult:='';
for n in (select t.xz,count(1) as cou
from v_subxmcx_list t where substr(t.xzq_dm,0,4)='3302' and t.userid=USER_ID ?and t.xz is not null? and t.xmzt!='3'

group by t.xz ) loop
strresult:=strresult||'&'||n.xz||','||n.cou;
end loop;
if strresult is not null then
???????? str:=substr(strresult,2);
end if;
EXCEPTION
??? WHEN OTHERS THEN
??????? RAISE;
??????? ROLLBACK;
end PRO_TDZZ_XZ_XMSL;

?

轉(zhuǎn)載于:https://www.cnblogs.com/huodige/p/8962846.html

總結(jié)

以上是生活随笔為你收集整理的js动态创建元素之一--document.write的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。