One of the elements dynamically created by js --document.write

Take the example I have written

As shown in the figure above, the names and numbers of townships and streets are obtained from the data in the database. If there are several towns, several will be displayed, which requires dynamic acquisition of the names and numbers of towns. Document.write is used in the following code to create a dynamic page. , when using document.write, pay attention to the use of the escape character \, otherwise it is easy to report an error

<script language="JavaScript"type="text/javascript">
var uid=getQueryString("userId");//Get the user link id
var str=xz_xmsl(uid);//Get the town name and number of functions  

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'>乡镇街道</caption>");
for (var i=1;i<=res.length;i++)
{

if((i%6)==1) //Start creating a list when the number of townships is more than 1
document.write("<tr>");

document.write("<td width='250' valign='top'>");
document.write("<ul class='left_li'>");
document.write("<li class='ico5' onClick =\"gotopage1(\'\',\'item query\',\'"+res[i-1].split(',')[0]+"\',\'\')\"> ");//gotopage1 is the function to get the link address, click on a township, it will jump to the specific information of the township
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) //When the remainder of the number of items is 0 or equal to the total length, start wrapping
document.write("</tr>");
}
document.write("</table>");
</script>

 

The function xz_xmsl gets the town name and number

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();//调用了存储过程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;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324973577&siteId=291194637