我可以在此代码中添加哪些内容以确保结果由一行或一行分隔?当我运行脚本时,结果返回哪个部分在其他部分之上没有任何sperataor因此很难确定下一个部分的开始位置
<code>
<script type="text/javascript">
// input field descriptions
var desc = new Array();
desc['PROC_CODE'] = 'Procedure Code';
desc['MEDICARE'] = 'Medicare Advantage';
desc['STATUS'] = 'Procedure';
desc['ID'] = 'Specialty';
desc['SYS_APP'] = 'Precert Type';
desc['SUBMITTER'] = 'Review Type';
desc['EMAIL'] = 'Guidelines';
desc['ADD_CPT'] = 'Additional Information for CPT';
desc['change'] = 'Prior Change Information';
<!--------->
desc['PROC_CODE1'] = 'Procedure Code';
desc['MEDICARE1'] = 'Medicare Advantage';
desc['STATUS1'] = 'Procedure';
desc['ID1'] = 'Specialty';
desc['SYS_APP1'] = 'Precert Type';
desc['SUBMITTER1'] = 'Review Type';
desc['EMAIL1'] = 'Guidelines';
desc['ADD_CPT1'] = 'Additional Information for CPT';
desc['change1'] = 'Prior Change Information';
<!--------->
desc['PROC_CODE2'] = 'Procedure Code';
desc['MEDICARE2'] = 'Medicare Advantage';
desc['STATUS2'] = 'Procedure';
desc['ID2'] = 'Specialty';
desc['SYS_APP2'] = 'Precert Type';
desc['SUBMITTER2'] = 'Review Type';
desc['EMAIL2'] = 'Guidelines';
desc['ADD_CPT2'] = 'Additional Information for CPT';
desc['change2'] = 'Prior Change Information';
<!--------->
desc['PROC_CODE3'] = 'Procedure Code';
desc['MEDICARE3'] = 'Medicare Advantage';
desc['STATUS3'] = 'Procedure';
desc['ID3'] = 'Specialty';
desc['SYS_APP3'] = 'Precert Type';
desc['SUBMITTER3'] = 'Review Type';
desc['EMAIL3'] = 'Guidelines';
desc['ADD_CPT3'] = 'Additional Information for CPT';
desc['change3'] = 'Prior Change Information';
<!--------->
desc['PROC_CODE4'] = 'Procedure Code';
desc['MEDICARE4'] = 'Medicare Advantage';
desc['STATUS4'] = 'Procedure';
desc['ID4'] = 'Specialty';
desc['SYS_APP4'] = 'Precert Type';
desc['SUBMITTER4'] = 'Review Type';
desc['EMAIL4'] = 'Guidelines';
desc['ADD_CPT4'] = 'Additional Information for CPT';
desc['change4'] = 'Prior Change Information';
<!--------->
desc['PROC_CODE5'] = 'Procedure Code';
desc['MEDICARE5'] = 'Medicare Advantage';
desc['STATUS5'] = 'Procedure';
desc['ID5'] = 'Specialty';
desc['SYS_APP5'] = 'Precert Type';
desc['SUBMITTER5'] = 'Review Type';
desc['EMAIL5'] = 'Guidelines';
desc['ADD_CPT5'] = 'Additional Information for CPT';
desc['change5'] = 'Prior Change Information';
function CopyFields(){
var copytext = '';
for(var i = 0; i < arguments.length; i++){
copytext += desc[arguments[i]] + ': ' + document.getElementById(arguments[i]).innerText + '\n' ;}
var tempstore = document.getElementById(arguments[0]).innerText;
window.clipboardData.setData('Text', copytext + '\n');}
function show(ele) {
var srcElement = document.getElementById(ele);
if(srcElement != null) {
if(srcElement.style.display == "block" ) {
srcElement.style.display= 'none';
}
else {
srcElement.style.display='block';
}
return false;
}
}</script>
<code>
这是对copyFields()
的调用 <code>
<a href="#" onClick="CopyFields(
'PROC_CODE','MEDICARE', 'STATUS', 'ID', 'SYS_APP', 'SUBMITTER','EMAIL','ADD_CPT','change',
'PROC_CODE1','MEDICARE1', 'STATUS1', 'ID1', 'SYS_APP1', 'SUBMITTER1','EMAIL1','ADD_CPT1','change1',
'PROC_CODE2','MEDICARE2', 'STATUS2', 'ID2', 'SYS_APP2', 'SUBMITTER2','EMAIL2','ADD_CPT2','change2',
'PROC_CODE3','MEDICARE3', 'STATUS3', 'ID3', 'SYS_APP3', 'SUBMITTER3','EMAIL3','ADD_CPT3','change3',
'PROC_CODE4','MEDICARE4', 'STATUS4', 'ID4', 'SYS_APP4', 'SUBMITTER4','EMAIL4','ADD_CPT4','change4',
'PROC_CODE5','MEDICARE5', 'STATUS5', 'ID5', 'SYS_APP5', 'SUBMITTER5','EMAIL5','ADD_CPT5','change5');"><b>Cli ck To Copy ALL data returned on this page</b></a></code>
答案 0 :(得分:2)
查看join
功能:
var a = ["foo", "goo", "boo"];
console.log(a.join("\n"));
控制台输出:
> foo
> goo
> boo