Well for SEO I would say put the ad networks code in an iFrame. The only reason is because if the ad server is down and your site doesn't completely load because of it then that won't be good for SE spiders.
Neither Iframe nor java script is better in point of seo but You should use java script because it does not cached by spiders.
I agree with all my friends as they have already mention that neither javascript nor Iframe are good for seo purpose but if you want to use any one of them then you can go for javascript because when visitors visit your site the loading process is fast because of that and visitors dont click that small X.
SEO for ads? Why would you want to do that? For ads, I'd put the ad in iframe if it contains JS, so that it doesnt affect the main page loading time.
According TO me for the purpose of SEO none of these two is a good choice but still if no other option is available or due to restrictions we can't use other options beside these two then i will opt javascript
use of JS is better than the use of iFrames if you have to make the choice between the two. the content in the JS is indexed by the search engines.
I will suggest JavaScript against IFrame...But from the SEO Point of view data generated by in JS or Iframe are not considered.
both options you have mentioned here are not useful for seo. B'coz SE crawlers doesn't like iFrames and javascripts.
Its true that both IFrame and Java Script are not good for SEO purposes. But if you still want to go for it , I will suggest Java Script.
So my take on the question is, while optimizing a website for SEO, which is better (iFrame or Javascript) for "ads only" to NOT AFFECT or DECREASE the websites SEO. I don't think anyone wants the actual ads to be optimized. I'm working on a site that has anywhere from 6-12 ads on the header and side column. Each ad has a considerable amount of javascript. Though JavaScript does load faster, if the ad server is slow it will slow your page load. With google now taking page load time into their search algorithms my thought is that iFrames would be better because they are different pages being loaded. Faster load time = better SEO rankings. (Though only about 1% of search queries are affected by page speeds). The better part of using iFrames is that it removes a lot of clutter from the page making it easier for the real content of the page to be discovered and indexed. If each ad has 25 lines of JavaScript and i have 12 ads, that's 300 lines of code I've cleared away for the spider. I can replace that with 12 lines that reference iFrames.
Ricky86, I can't seem to find any references to Google saying that iframes (in general) are bad. I could only find a thread mentioning that when using ADSENSE, to not use iframes. http://forums.digitalpoint.com/showthread.php?t=53643 I guess the question for the original poster is....are you using google AdSense or not? If so. I'd like to learn WHY google says this and some links to back it up.