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 16:00, local time: 2024/8/22 20:21,
3.145.72.199: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://piclist.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? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.