The JavaScript interpreter in Internet Explorer 3.0 does not always convert objects to strings when they are used in a "string context". This happens most notably when objects are assigned to the value field of form elements. To make this work correctly, you have to explicitly convert the object to a string, either by invoking its toString() method or by adding the empty string to it. To display the date and time in a form, for example, you'd have to use code like this:
today =index.html new Date(); document.forms[0].dateandtime.value = today.toString()
today =index.html new Date(); document.forms[0].dateandtime.value = today + "";
If you encounter this conversion problem in other contexts, the workaround is the same.
file: /Techref/language/JAVA/SCRIPT/definitive/appd_03.htm, 4KB, , updated: 2019/10/14 15:00, local time: 2024/11/26 17:17,
18.116.85.102:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/language/JAVA/SCRIPT/definitive/appd_03.htm"> [Appendix D] D.3 Form Values and String Conversion</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.