以前、外部ファイルが実行されていないというこの問題がありました。
代わりにファイルを動的にロードすることでこれを修正しました...つまり、JavaScriptで要素を作成し、 .src 属性を介してリンクします( html で scrip タグを使用する代わりにこれを行いました)。ここで似たようなことをする必要がありますか?
これは、本文の .innerHTML を介して挿入された、実行する必要がある埋め込み JavaScript です。現在、私のページでは「デッドコード」です。set 関数の 2 番目の変数として渡す json に注意してください。これは PHP で構成され、ajax POST を介してクライアントに渡されます。
<script type='text/javascript'>new Arc.Shared().set( 'tweet_data', [{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"Hi","3":"Hi","time":"1338559048","4":"1338559048"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"hi","3":"hi","time":"1338558809","4":"1338558809"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"<a class=\"bookmark_tweet\" target=\"_blank\" href=\"http:\/\/ebay.com\">ebay <\/a>","3":"<a class=\"bookmark_tweet\" target=\"_blank\" href=\"http:\/\/ebay.com\">ebay <\/a>","time":"1338504456","4":"1338504456"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"foo","3":"foo","time":"1338504225","4":"1338504225"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"foo","3":"foo","time":"1338504222","4":"1338504222"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"foo","3":"foo","time":"1338504220","4":"1338504220"},{"id":"1","0":"1","picture":"0","1":"0","name":"Test Account","2":"Test Account","tweet":"foo","3":"foo","time":"1338504217","4":"1338504217"}] );</script>
ノート:
評価スニペットの代替:
var myCode = 'alert("Howdy?");';
var myFucn = new Function(myCode);
myFucn();