如何获取文本框的值?? <html:text property="orders.ordersTell"></html:text>ordersTell=document.getElementById("orders.ordersTell").value;这样获取值不行吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 getElementById()里面是property,不是id 页面不复杂可以那样用的而id应该是ordersTell而不是你写的那样property="orders.ordersTell"> 这个是动态的最后再html中是以name=ordersTell形式出现的你可以通过查看源代码查看 要加上 name="form名字",才能解析到对应的FormBean属性,然后再用就没问题了。其实你可以看jsp编译之后的html源码,html:text的property最终变成的是input type=text 的name属性。 document.getElementById("id").text(); document.getElementById("id").html(); JQuery $('#id').html $('#id').text <html:text property="orders.ordersTell"> </html:text> ordersTell=document.getElementById("orders.ordersTell").value; property是与你写的FormBean内定义的属性相对应的。当它解析为html语言时,property就是想对应的input标签中的id。如果你的property确实和FormBean中的属性相对应,而且就是orders.ordersTell,按理论上来说应该可以吧。但我看你写的orders.ordersTell,难道你想给这个文本框动态赋值?如果赋值的话可以用struts标签<bean:write>来赋值,也可用el表达式。如:假如FromBean叫orders(当然这样起类名不是很好),它有一个属性ordersTell。<html:text property="ordersTell"> ${orders.ordersTell}</html:text> 在js中就可以根据property获得值了。var ordersTell=document.getElementById("ordersTell").value; ordersTell=document.getElementById("orders.ordersTell").value; 生成html页面后在浏览器里查看该文本框的id,然后在document.getElementsById('Id名').value; 新手求教关于SSH框架的一个小问题~~~ SSH框架 Spring3.0 appliactionContext.xml文件在没网的情况下会报错 请教一Excel数据导入到数据库中去! weblogic集群,数据库锁的问题 最简单的注册,不知道是不是spring没有注入,一直出现空指针~~~ 集合类自动排序 我是菜鸟,想学j2ee,希望有经验的人给我点学习建议 关于cmp实体Bean在Weblogic Server上的问题 web service 中数据库查询超时。 hibernate 菜鸟问题 请教一个tomcat的问题 dom4j生成xml,中文乱码,如何解决
而id应该是ordersTell而不是你写的那样
property="orders.ordersTell"> 这个是动态的
最后再html中是以name=ordersTell形式出现的
你可以通过查看源代码查看
要加上 name="form名字",才能解析到对应的FormBean属性,然后再用就没问题了。
其实你可以看jsp编译之后的html源码,html:text的property最终变成的是input type=text 的name属性。
document.getElementById("id").html();
JQuery $('#id').html $('#id').text
但我看你写的orders.ordersTell,难道你想给这个文本框动态赋值?如果赋值的话可以用struts标签<bean:write>来赋值,也可用el表达式。
如:假如FromBean叫orders(当然这样起类名不是很好),它有一个属性ordersTell。
<html:text property="ordersTell"> ${orders.ordersTell}</html:text> 在js中就可以根据property获得值了。
var ordersTell=document.getElementById("ordersTell").value; ordersTell=document.getElementById("orders.ordersTell").value;