开发者

EncodeURIComponent throwing "Object doesn't support this property or method" Error (IE 8)

开发者 https://www.devze.com 2023-03-15 07:18 出处:网络
The following line is throwing a Object doesn\'t support this property or method\" Error on IE 8.0.6 on Windows XP. I\'ve looked into the encodeURIComponent method and I\'ve been unable to find anyone

The following line is throwing a Object doesn't support this property or method" Error on IE 8.0.6 on Windows XP. I've looked into the encodeURIComponent method and I've been unable to find anyone else experiancing this. Is this my issue here, or does it have to be something else? Thank you!

request_type = encodeURIComponent(document.getElementById("request_type").value开发者_运维技巧);


It might actually be complaining about ".value"

Try breaking the code up like this:

var el = document.getElementById("request_type");
var val = el.value;
var encodedVal = encodeURIComponent(val);

If the script dies on the second line, then that means line 1 is trying to get an element that doesn't exist.

0

精彩评论

暂无评论...
验证码 换一张
取 消