Creating an iframe playlist that loops through urls (from a node field)
I'd probably do this in two steps (all within the formatter hook).


Separate the js processing into an external include, added via drupal_add_js(); 
Put the urls into Drupal.settings.mymodule.playlist and call these from your ChangeSrc() function.
If you're wanting to do it semantically, skip point 2 and just ouptput &lt;a href="src" data-something="60"&gt; in your formatter markup. Then pull those hrefs with your js and inject them into the iframe.




Standard code for including custom js settings:

$settings = array();
$settings['mymodule']['playlist'][] = array('url1','metadata1');
drupal_add_js($settings, 'setting');