您的位置:程序门 -> java -> web services / xml



请javascript高手帮忙,非着急了,下半夜求救啊啊啊啊


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


请javascript高手帮忙,非着急了,下半夜求救啊啊啊啊
发表于:2007-08-20 00:35:09 楼主
<html>
  <head>
    <title>   new   document   </title>
   
  </head>

  <body>
            <script   language= "javascript "   type= "text/javascript ">
               
                  var   i=0;
                  function   addtxt()
                        {
      i=i+1;
                        var   str   =   ' <p> <input   type= "text "   name= "txt "+i   /> </p> '
                        document.getelementbyid( 'filecollection ').insertadjacenthtml( "beforeend ",str)

                        }
             
  </script>

<div   id= "filecollection ">
      <input   onclick= "addtxt() "   type= "button "   value= "增加+ "   /> &nbsp;
  </body>
</html>

比如我增加了3个text,value分别等于aa,bb,cc,我如何在下个jsp页面获得这3个参数,请高手指教啊。小弟谢谢。
发表于:2007-08-20 01:12:241楼 得分:0
<html>
  <head>
    <title>   new   document   </title>
  </head>
  <body>
            <script   language= "javascript "   type= "text/javascript ">
                  var   i=0;
                  function   addtxt()
                        {
      i=i+1;
                        var   str   =   ' <p> <input   type= "text "   name= "txt "+i   /> </p> '
                        document.getelementbyid( 'filecollection ').insertadjacenthtml( "beforeend ",str)

                        }
function   save(){
var   list   =   document.getelementsbytagname( "input ");
var   textlist   =   new   array();
for   (var   i=0   ;   i <list.length   ;   i++){
var   input   =   list[i];
if   (input.id   !=   "add "   &&   input.id   !=   "save "){
textlist.push(input);
}
}
var   param=new   object();
param.textlist   =   textlist;

opensimdialog( 'aa.html ',600,300,null,param);
}
function   opensimdialog(url,   width,   height,   returnfunc,   args)   {
if(args   ==   null)
args   =   new   object();
args.parentwindow   =   self;
if   (typeof   window._curusr!= 'undefined '){
args._curusr=window._curusr;
}
var   sfeatures   =   "dialogheight:   "   +   height   +   "px; "   +   "dialogwidth:   "   +   width   +   "px; ";
window.showmodaldialog(url,   args,   sfeatures);
}
  </script>
<div   id= "filecollection ">
      <input   onclick= "addtxt() "   id= 'add '   type= "button "   value= "增加+ "   /> &nbsp;
      <input   onclick= "save() "   id= 'save '   type= "button "   value= "保存 "   />
  </body>
</html>

===============================================================================
===============================================================================
<html>
<head> <meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 ">
        <title> 用户登录 </title>
<script   type= "text/javascript ">
window.onload   =   function(){
initparameter();
var   textlist   =   _param.textlist;
for   (var   i=0   ;   i <textlist.length   ;   i++){
alert(textlist[i].value);
}
}
function   initparameter()   {
if(window._param   ==   undefined   &&   window.dialogarguments   !=   undefined)   {
window._param   =   window.dialogarguments;
window._parent   =   _param.parentwindow;
if   (typeof   _param._curusr   !=   'undefined ')
{
window._curusr=_param._curusr;
}
}
}
</script>
</head>
<body   >
</body>
</html>


快速检索

最新资讯
热门点击