function     remindDel(aaa){       
                    var   isDel   =   confirm("您确定要删除这条信息吗?");       
                    if(isDel){ 
                        alert(aaa);       
                        document.getElementById(aaa).click();   
                        alert(document.getElementById(aaa).id);   
                }else{ 
                      return; 
                }   
<td> 
<a   class="delete"   onClick="remindDel(' <bean:write   name="inportFromExcel"   property="inportexecutetime"/>   ')"> 
</a> 
<a   id=" <bean:write   name="inportFromExcel"   property="inportexecutetime"/>   "   style="display:none"   href="..."> 
</a> 
</td> 也就是说我以<bean:write   name="inportFromExcel"   property="inportexecutetime"/> 来做id值,可这样触发不了 <a> ,就是不跳转,函数里的alert都是正常的(值也一样). 
当我把两个 <bean:write> 换成常量时(如下),就能触发 <a> 使页面跳转,但这样做是处理不了载后的多数据项的问题. 
<td> 
<a   class="delete"   onClick="remindDel('sss')"> 
</a> 
<a   id="sss"   style="display:none"   href="..."> 
</a> 
</td> 所以我想问题就出现在javascript,html和struts标签之间的影响上,可出现在哪呢? 这个问题看似简单却整了我快两天了,可急死我了

解决方案 »

  1.   

    问题暂时解决 
    这种解决的方法说明了这个问题的奇怪性 
    我把javascript中获取id的方法改为obj.nextSibling这可以了,也就是不取id了,直接取下一个节点 
        function   remindDel(obj){ 
        var   isDel   =   confirm("您确定要删除这条信息吗?"); 
        if(isDel){ 
                obj.nextSibling.click(); 
        }else{ 
                return; 
        } 
        } <a   class="delete"   id="delTag"   onClick="remindDel(this)"   href="javascript:void(0)"> 
    </a> 
    <a   style="display:none"   href="inportStatisticsDelete.do?inportfilename= <bean:write   name="inportFileName"/> &inportType= <bean:write   name="inportFromExcel"   property="inporttype"/> "   > 
    </a> 可以前是什么问题呢?至今还没弄明白 还在努力中...希望对大家有所借鉴