开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜