js innerHTML 操作struts标签

本文探讨了Struts标签无法通过JavaScript的INNERHTML属性动态创建的问题。解释了Struts标签只能在服务器端解析,而JavaScript在客户端运行,因此只能操作标准HTML元素。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

翻译的文章在这:http://www.coderanch.com/t/54364/Struts/INNERHTML

那个解答原文是:

When you create HTML dynamically with INNERHTML, you must use regular HTML tags, not Struts tags. So, rather than create an <html:text> tag, you must create an <input type="text"> tag.

Struts tags can only be evaluated on the server and then rendered into regular HTML before being sent to the browser. Since JavaScript executes on the browser, you must deal exclusively with regular HTML, and not with tags that are interpreted on the server.

 

大意就是:

Struts 的标签只能被服务器解释,而js只能操作html的标签!

 

所以你使用innerHTML +=struts标签可不对,我也试过,真的不行

另外看到其他中文的文章,如:

http://www.iteye.com/topic/132037

中zarger也提到了这个问题!

我不知道这样还有没有别的解释,如果大家谁有好的解释,及时告诉我好么!!!

谢谢大家,一起进步吧。 

哦,还有别的方法:http://blog.youkuaiyun.com/grubbyfan/archive/2009/01/09/3743344.aspx不过我没试过。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值