Quantcast
Viewing latest article 2
Browse Latest Browse All 9

Some JavaScript issues

1. While using toUpperCase() function you may meet following error:

Object doesn’t support this property or method

Try to use following trick to solve your problem:

sName = Request.Form("UserId").toString().toUpperCase();
or
sName = Request.Form("UserId") + "";
sName = sName.toUpperCase();

2. If you try to add some additional methods for HTMLElement (DOM Elements) class you will probably waste some time with “HTMLElement is undefined” issue.

HTMLElement.prototype.newMethod = function()

{…}

=> HTMLElement is undefined

This problem is just for IE browser.

Solution:

1.You need to define function with additional parameter containing Element (DOM element) value:

var coolMethod = function( element, test1, test2){ …}

or

2.You may use new html5 capabilities defining Element class instead of HTMLElement with code:

if(!HTMLElement){var HTMLElement = Element;}


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 2
Browse Latest Browse All 9

Trending Articles