1.现有一个Test.js文件 内容如下:var _count=0;
function showContent()
{
   var opt="";
   opt="<div><ul>";
   for (var i=0;i<_count;i++)
   {
      opt+="<li>数据</li>";
   }
   opt+="</ul></div>";
}
2.现有一个html页面,有二个TextBox,当点击(onclick)每个TextBox时,会将Test.js中showContent()的层内容显示出来。
<input type='text' id='txt_1' onclick='showContent()'/>
<input type='text' id='txt_2' onclick='showContent()'/>
<script>这里该怎么写一个js或是方法设置 txt_1 显示内容的个数和txt_2 显示内容的个数和</script>
注:最好不是改方法:showContent()为   showContent(count) 最后谢谢大家!!!!!

解决方案 »

  1.   

    <script>这里该怎么写一个js或是方法设置 txt_1 显示内容的个数和txt_2 显示内容的个数和 </script> 
      

  2.   

    问题描述不清楚,设置 txt_1 显示内容的个数?是什么什么意思,再者showContent方法里并不会显示什么东西,只是拼了个字符串而已。
    若是想改变_count可以这样
    onclick='_count=10,showContent()'