Skip to content Skip to sidebar Skip to footer

Script5007: Unable To Get Property 'value' Of Undefined Or Null Reference

I have a html form that appears not to be functional in IE10. when click on go button debugging returns:'SCRIPT5007: Unable to get property 'value' of undefined or null reference'

Solution 1:

I don't think IE 10 supports acessing elements with the myform.freq.value syntax anymore.

The standard way of accessing Elements (this is supported in all browsers including IE) is with the document.getElementById function

functionbuildQueryStr(myform) {

    //var freq=myform.freq.value; //Getting an error SCRIPT5007: Unable to get property 'value' of undefined or null reference in this linevar freq=document.getElementById("freq").value;

    //some other fields.
}

Solution 2:

First: you shouldn't be using document.all, not in 2013 :) It's an old Microsoft extension and I think it's deprecated. Use getElementById.

I think there's something wrong in the way you create your selectStr. You're gonna use it as innerHTML for a Select so:

  • it should NOT end with a </select>. The closing tag for an element is not part of its innerHTML afaik
  • you should have closing tags for your <option> elements

I'd change the following piece of code:

// checking some condition for freqValues.for(var i=4;i<freqValues.length;i++)
        selectStr += '<option value="'+freqValues[i]+'">'+freqTexts[i]+'\n';
}
selectStr += '</select>';

into this:

// checking some condition for freqValues.for(var i=4;i<freqValues.length;i++)
        selectStr += '<option value="'+freqValues[i]+'">'+freqTexts[i]+'</option>\n';
}

NOTE: I've read somewhere that using innerHTML on SELECT controls has a really browser-dependant behaviour, even when using correctly formatted code. I think a more robust solution would be using removeChild and addChild to dinamically remove and add options nodes .

Solution 3:

Issue is related to document mode , IE11 default document mode is IE7.

Using F12 in IE Emulation you can change document mode 8,9 and 11

You can use following tag to change document mode using programming.

For versions of Internet Explorer 8 and above, this:

<metahttp-equiv="X-UA-Compatible"content="IE=9; IE=8; IE=7" />

Forces the browser to render as that particular version's standards. It is not supported for IE7 and below.

If you separate with semi-colon, it sets compatibility levels for different versions. For example:

<metahttp-equiv="X-UA-Compatible"content="IE=7; IE=9" />

Renders IE7 and IE8 as IE7, but IE9 as IE9. It allows for different levels of backwards compatibility. In real life, though, you should only chose one of the options:

<metahttp-equiv="X-UA-Compatible"content="IE=8" />

This allows for much easier testing and maintenance. Although generally the more useful version of this is using Emulate:

<metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE8" />

For this:

<metahttp-equiv="X-UA-Compatible"content="IE=Edge" />

It forces the browser the render at whatever the most recent version's standards are. Just like using the latest version of jQuery on Google's CDN, this is the most recent, but also can potentially break your code since its not a fixed version.

Last , consider adding this little tidbit:

<metahttp-equiv="X-UA-Compatible"content="IE=Edge,chrome=1" />

Adding "chrome=1" will allow the site to render in ChromeFrame for those (intelligent) users who have it, without affecting anyone else.

`enter code here

`https://technet.microsoft.com/en-us/itpro/internet-explorer/ie11-deploy-guide/fix-compat-issues-with-doc-modes-and-enterprise-mode-site-list

https://msdn.microsoft.com/library/ms533876(v=vs.85).aspx

http://www.chromium.org/developers/how-tos/chrome-frame-getting-started

Post a Comment for "Script5007: Unable To Get Property 'value' Of Undefined Or Null Reference"