最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Javascript Error in IE9 "SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5)" - Stack Overflow

programmeradmin5浏览0评论

When I debug in IE9, It breaks on the following line

{var c=document.createElement('<iframe id="'+a+'" name="'+a+'" />')

with the following error:

SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5) 
wmd.js, line 1 character 97

I am using OSQA software, and the bug may be reproduced with the latest version of IE9 (possibly with web developer toolbar installed)

/ (bug may be reproduced as of 1/3/12)

If you visit that page, open up the javascript console, and attempt to upload any image using the image uploader, the error occurs.

This only breaks on IE9 for some reason

Update

I'm a bit new to this javascript debugging business, but I opened up the watch menu and the value of "a" is: jUploadFrame1325624808664

When I debug in IE9, It breaks on the following line

{var c=document.createElement('<iframe id="'+a+'" name="'+a+'" />')

with the following error:

SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5) 
wmd.js, line 1 character 97

I am using OSQA software, and the bug may be reproduced with the latest version of IE9 (possibly with web developer toolbar installed)

http://meta.osqa/questions/ask/ (bug may be reproduced as of 1/3/12)

If you visit that page, open up the javascript console, and attempt to upload any image using the image uploader, the error occurs.

This only breaks on IE9 for some reason

Update

I'm a bit new to this javascript debugging business, but I opened up the watch menu and the value of "a" is: jUploadFrame1325624808664

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Jan 3, 2012 at 21:05 Brian WebsterBrian Webster 30.9k51 gold badges157 silver badges226 bronze badges 2
  • The wmd.js where this error occurs seem to be a 3rd party library. Report it to the library's maintainer. – BalusC Commented Jan 3, 2012 at 21:12
  • 1 Since that is part of some minified javascript, I remend splitting it out for debugging. You want to be absolutely certain where the error is occurring. See jsbeautifier – Jeffrey Blake Commented Jan 3, 2012 at 21:20
Add a ment  | 

3 Answers 3

Reset to default 9

The createElement method expects only the name of the element to create. Like this:

var c = document.createElement("iframe")

Properties can be added to the new element later:

c.id = c.name = a;

Previous versions of IE allowed you to provide this function with arbitrary HTML, but that was never part of the spec and is no longer supported in IE9.

To use createElement, you should only give it a tag name.

var c = document.createElement('iframe');
c.id = c.name = a;
var c=document.createElement('iframe');
c.id=a;
发布评论

评论列表(0)

  1. 暂无评论