Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Why is script line needed to change values
- From: twlewis at SoftHome.net (twlewis@xxxxxxxxxxxx)
- Subject: [Javascript] Why is script line needed to change values
- Date: Mon May 21 16:17:21 2007
You are too excellent Nick! I changed it to little v, removed the line referring to VBScript, and it works great. Thank you! > On 21 May 2007, at 21:45:10, twlewis@xxxxxxxxxxxx wrote: > >> I apologize, because this is a little off-topic from javascript. I >> had >> completed my javascript, which loads data to a textarea. It would not >> load the textarea. I have a VBScript version that worked. After much >> careful elimination of code on the VBScript version, I found that >> the line >> that was making the onclick work was the script statement. I >> created a >> chopped down version to test and play with. In the script below, if I >> remove the line >> <script Language="VBScript" src="none"></script>, >> the onclick no longer works. I can paste it back in, and the button >> changes as it is supposed to. Can someone please explain this to me? >> Thank you for your patience and explanation. >> Tim >> >> >> <html> >> <head> >> <script Language="VBScript" src="none"></script> >> >> </head><body> >> <form id=myform> >> <input type="button" value="Click me!" id=Button1 name="button"> >> >> <input type="button" value="Change button 1 to monkey" >> onclick="Button1.Value='monkey'"> >> >> </form> >> </body> >> </html> > > The presence of a <script> tag with "language="VBScript" will cause > Internet Explorer to assume that the onclick="" handler is in > VBScript. VBScript is case-insensitive, unlike JavaScript, and the > "value" property starts with a lower-case "v". > > So if you remove the <script> tag and use > > Button1.value = 'monkey' > > (instead of Value) for the onclick attribute then it will work in all > browsers that support JS, whereas at the moment it will only work in IE. > > HTH, > > Nick. > -- > Nick Fitzsimons > http://www.nickfitz.co.uk/ > > > > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > https://lists.LaTech.edu/mailman/listinfo/javascript >
- Follow-Ups:
- [Javascript] Why is script line needed to change values
- From: Nick Fitzsimons
- [Javascript] Why is script line needed to change values
- References:
- [Javascript] Why is script line needed to change values
- From: twlewis@xxxxxxxxxxxx
- [Javascript] Why is script line needed to change values
- From: Nick Fitzsimons
- [Javascript] Why is script line needed to change values
- Prev by Date: [Javascript] Why is script line needed to change values
- Next by Date: [Javascript] Unobtrusive Javascript
- Previous by thread: [Javascript] Why is script line needed to change values
- Next by thread: [Javascript] Why is script line needed to change values
- Index(es):