on 03-19-2004 7:52 PM
Hi,
I am building a table using HTMLB. I need to call a javascript function within a <td>. The javascript formats the date. While adding to the Vector I add the cell content as
row.addElement("<script language=\"javascript\">dwColDateTime(new Date("date"));</script>");
Where date is a string.
In my JSP I have the following javascript function
<script language ="javascript">
function dwColDateTime(dt){
fdate = new Date(dt.getTime() + zonediff);
document.write(fdate);
}
</script>
When my table shows up, it shows the content of <td> as it is ie,
<script language="javascript">dwColDateTime(new Date(2004,2,19,08,45,0));</script>
Without HTMLB the javascript works fine.
How do I call the javascript function from within my cell in TableView?
Any ideas will be highly appreciated.
Thanks
lakshmi
Used encode() method to encode my Javascript before adding to the table and it worked fine.
Lakshmi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the htmlb control escapes the html code you've added (don't know if there is any way to avoid this).
If possible, it would be best to move the javascript code to the java dynpage code instead, avoid the problem alltogether
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.