简体   繁体   中英

How to change iframe source

the issue is that I'm trying to develop a web site and I'm using Google Web Design. So far so good. I've inserted an iFrame and I want to change it's source when I'm pressing a button. Every search that I've googled speaks about "src" but my iFrame has "source" attribute. I've tried almost every solution that I found but I gave up. It may be a stupid question but how am I supposed to do it? I've used "document.getElementById("myId")" or "window.frames['id']"... Not a chance. Anyone have an idea? Thanks a lot.

<iframe is="gwd-iframe" id="textToShow" source="" class="gwd-iframe-15nv gwd-gen-mv4zgwdanimation" style="background-image: none;" scrolling="auto">
</iframe>

gwd.goOnTheWeb = function(event) {
    //should be in here
};

After some researches I've managed it. Finally, in Google Web Design there is an option in the right-click -> Add event... on an imageButton, called iFrame, that allows you to load an external page into an iframe. On the other hand, hopefully, I've found that somehow the "source" attribute of an iframe that the software writes automatically in code (I'm using OS X), is about to "guide" Safari while "src" is for browsing on Windows. Excuse me, please if I'm kind of "out-of-topic" but even being in IT, I've never developed a site since. So, have mercy. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM