http://code.google.com/p/swfobject/にある swfobject へのインターフェイスを作成しようとしています。ユーザーが Flash Player をインストールしていない場合に必要な代替コンテンツを構築しています。これは FF では問題なく動作しますが、何らかの理由で IE では動作しません。私はこれを何百万回も前に同じ方法で実行しましたが、常に機能していましたが、今回このエラーが発生する理由がわかりません。
基本的に、ページが読み込まれると、代替コンテンツを構築する関数 $.SWFObject.embedSWF() が呼び出され、swfobject.embedSWF 関数が呼び出されます。代替コンテンツは、次のような Ready 関数で構築されます。
setupAlternateContent 関数が呼び出されると、('#' + containerID) でエラーが発生します。
embedSWF: function(flashFilename, containerID, width, height, minFlashVersion, flashvars, params, attributes) {
//If the flashvars, params, or attributes variables were passed in and are objects, then save them, otherwise they will be empty.
settings.flashvars = (flashvars && typeof(flashvars) == 'object') ? flashvars : {};
settings.params = (params && typeof(params) == 'object') ? params : {};
settings.attributes = (attributes && typeof(attributes) == 'object') ? attributes : {};
//Setup the alternate content that will be used if the user does not have flash installed
$(document).ready(function() { setupAlternateContent(containerID); });
//Call the embedSWF function which is found in the swfobject core file
swfobject.embedSWF(flashFilename, containerID, width, height, minFlashVersion, flashUpdater, settings.flashvars, settings.params, settings.attributes);
}
function setupAlternateContent(containerID) {
//Create the innerContainer div element
var innerContainer = $.create('div', {
}).appendTo('#' + containerID).css({
font: '18px Arial, Verdana, sans-serif',
height: '130px',
width: '240px',
paddingTop: '35px',
margin: '0px auto'
});
//Put the flash image inside the innerContainer
$.create('img', {
src: SWFOBJECT_FOLDER_LOCATION + 'flash_icon.png',
alt: 'Install Flash'
}).appendTo(innerContainer).css({cursor: 'pointer'}).click(function() { window.location = 'http://get.adobe.com/flashplayer'; });
//Add a message bellow the flash icon
$.create('p', {}, 'Install Adobe Flash Player').appendTo(innerContainer);
}
IE は ('#' + containerID) 引数が好きではありません。これは以前に問題なく実行したため、意味がありません。また、 $.create の由来である jQuery DOMEC 拡張機能を使用しています。
どんな助けでも大歓迎です。ありがとう!
大都市