Jquery对话框IE9内容未使用html显示
Jquery dialog IE9 content not showing using html
我没有一个小型的客户端web应用程序。我已经在firefox、chrome、IE7、IE8和IE9中进行了测试。
现在我不能让它失败。它适用于我测试过的每一个浏览器/版本。我不确定我的客户使用的是什么版本,但他说是IE9。
代码是这样的:
function noticeBox(type, html, title) {
switch(type) {
case 1:
$('#notice_box').dialog({
title: title,
width: 400,
modal: true,
position: 'center',
buttons: {
'Ok': function() {
$(this).dialog('close');
}
}
});
break;
case 2:
$('#notice_box').dialog({
title: title,
width: 800,
modal: true,
position: 'center',
buttons: {
'Bekræft og bestil': function() {
$('#form_products').submit();
},
'Annuller': function() {
$(this).dialog('close');
}
}
});
break;
case 3:
$('#notice_box').dialog({
title: title,
width: 400,
modal: true,
position: 'center',
buttons: {
'Luk': function() {
$(this).dialog('close');
}
}
});
break;
}
alert(html);
$('#notice_box').html(html);
$('#notice_box').dialog('open'); }
不是一个非常通用的函数,但这正是目前失败的地方。他说,当对话框弹出时,对话框中没有任何内容。他可以看到按钮,但就像对话框中没有html一样。
有什么想法吗?
更新:顺便说一句,他可以激活几个对话框,所有对话框的结果都是一样的。没有任何内容的对话框。
更新2:我如何使用该函数的一个例子是这样的。当客户订购某些产品时:
function order() {
var procuct_str = '';
var found_order = false;
$.each($('.order_input'), function(){
var product_id = $(this).attr('id').split('-');
if(parseInt($(this).val()) > 0) {
found_order = true;
procuct_str = procuct_str+'<div class="float_left"><span class="bread_text">'+$('#description-'+product_id[1]).text()+'</span></div><div class="float_right"><span class="bread_text">'+$(this).val()+'</span></div><div class="clear"></div>';
}
});
if(found_order == true) {
procuct_str = '<div class="float_left"><b>Beskrivelse</b></div><div class="float_right"><b>Antal kasser</b></div><div class="clear"></div>'+procuct_str;
noticeBox(2, procuct_str, 'Bekræftelse');
var found_order = false;
} }
除非您在其他地方声明了html
变量,否则需要在函数的范围内访问它。根据您提供的代码,html
是一个函数参数,在函数之外,它总是"未定义"的。
它对我来说很好。
我用你的函数是这样的:
noticeBox(1, "<p>Hello</p>", "Test");
您的客户端为html参数提供了什么?一些html可能会把它搞砸。或者只是你的客户遗漏了它,这可以解释为什么什么都没有显示。
相关文章:
- 使用html中的外部javascript进行数据验证
- $rootScope未使用forEach进行更新
- 这是使用html快照和谷歌获取的预期结果吗?SEO/SPA
- 使用html表单中的参数调用JavaScript函数
- 如何忽略单词like“”中的未使用空格;测试-文本”;同时构建html标签
- 我的UTC时区函数未使用innerHTML显示在HTML上
- 在表单未传递的情况下使用.html()动态插入隐藏文本字段
- HTML方法未使用Document Ready加载值
- 部分html视图's控制器未使用KendoPanelBar内容URL在指令模板URL中工作
- 对象未定义/HTML使用jQuery输出
- 表数据未使用 KO.js MVC 显示为 HTML
- 组件未使用 grunt-wiredep 注入索引.html文件
- Jquery对话框IE9内容未使用html显示
- 无法设置属性'_renderItem'未定义的jQuery UI使用HTML自动完成
- html标签在Angularjs中未使用ng-bind-html显示
- 使用html模板时出现未捕获的语法错误
- 单击使用Html.ActionLink生成的链接上未触发的事件
- javascript错误'函数未定义'使用html onclick
- 使用html数据集id's的未定义变量
- html<text区域>未使用Jquery正确重置