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/30 02:10,
3.145.112.23: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://techref.massmind.org/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 massmind.org! |
Welcome to techref.massmind.org! |
.