我正在尝试在模态对话框中显示图像,但图像未显示。有人可以对此有任何想法吗?这是我完整的 html 布局。注意: div 内容中有 jquery。
html_content = "
<strong>"+title+"</strong>
<br>
<br>
<img src='"+single_image+"'width='300' height='211'>
<br> "+content+"
<br>"+str+"
<div id='image'></div>
<div id='dialog-modal' title='Basic modal dialog'>
<div id='popup' style='display:none'>"+"
<a id='popup-close' href='' class='button'>"+"Fermer"+"</a>
<p><img id='image-placeholder' width='300px'; height='250px' src=''>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$('.popup-open').click( function(e){
$('#popup:visible').hide();
e.preventDefault();
$('#image-placeholder').attr('src', $(this).attr('href'));
$('#popup').fadeIn('fast');
});
$('#popup-close').click(function(e){
e.preventDefault();
$('#popup').fadeOut('fast');
});
});
</script>
";
String mdialog = "
<link rel=\"stylesheet\" href=\"http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css\" />
<script src=\"http://code.jquery.com/jquery-1.8.2.js\"></script>
<script src=\"/resources/demos/external/jquery.bgiframe-2.1.2.js\"></script>
<script src=\"http://code.jquery.com/ui/1.9.1/jquery-ui.js\"></script>
<link rel=\"stylesheet\" href=\"/resources/demos/style.css\" />
<script>
$(function() {
$( '#dialog-modal' ).dialog({height: 140, modal: true});
});
</script>
<meta http-equiv=\"Content-Type\" " +"content=\"text/html; charset=utf-8\">
<style>
#popup{border: 1px solid gray; background-color:black; border-radius: 5px 5px 5px 5px; margin-left:auto; margin-right:auto; position:fixed; top:50px; z-index: 9999;}
</style>
";
String webData = "
<!DOCTYPE html>
<head>
"+mdialog+"
</head>
<body>
"+html_content+"
</tr>
</table>
</div>
</body>
</html>
";