[英]JavaScript - Form submit to window.open popup not working IE/FF
[英]Javascript not working in FF and IE popup window
嗨,大家好,我在Firefox和IE上遇到了一些奇怪的問題。 在此之前,我還沒有遇到過此類問題,請提供幫助。 我制作了一個自定義圖像瀏覽器以與ckeditor一起使用。 瀏覽器(一個彈出窗口)窗口將按預期方式打開,但是當我嘗試返回fileUrl或運行任何類型的JavaScript時,如果使用Firefox和IE,則不會發生任何事情。 鍍鉻一切都很好。
瀏覽器頁面代碼:
<?php
$path = "./public/user_images/demo_user/";
if(is_dir($path) == true){
$list = scandir($path);
if(count($list) >= 1){
foreach ($list as $key=>$value) {
if(is_file($path.$value)){
$file = base_url($path.$value);
echo <<<start
<button class="btn_browser_img">
<img src="$file" class='browser_img'><img>
</button>
start;
}
}
}
}else{
echo "Oops! Wrong folder...";
}
?>
背景Javascript:
$(".browser_img").click(
function(){
alert(this.getAttribute('src'));
fileUrl = this.getAttribute('src');
sendFileUrl(fileUrl);
}
);
function sendFileUrl(fileUrl){
window.opener.CKEDITOR.tools.callFunction( funcNum, fileUrl );
window.close();
}
this.getAttribute(...)
將不起作用,因為它對應於包裝jQuery對象。
所以試試this[0].getAttribute(...)
jQuery將實際對象存儲在第0個位置,因此this[0]
將為您提供DOM對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.