开发者

Internet Explorer, How to change iframes src

For some reasons I'm using an Iframe to display googlemaps, when I want to change it's content I'm just changing the Iframe src using JQuery.

$('#ggMap').attr('src', 'http://newurl.com');

Apparently it's not doing 开发者_Go百科anything on Internet Explorer.

Does anyone know how I could do the same thing with IE?


Not sure about jQuery, but regular javascript would be something like:

document.getElementById('ggMap').src = 'http://newurl.com';


I found that I had the same problem with IE8 and changing the src via jQuery/JS didn't work like this. What I now do is actually use jQuery.clone() to clone the iframe, then change it's src, then remove the original iframe and insert the clone...


You can set the src of an IFrame with javascript, so I guess there is a script error preventing IE from working properly.

Have you debugged the script?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜