按钮
<input type="button" id="button" value="Prompt">
的Javascript
<script>
$("#button").click(function(){
var check = prompt("this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample" , "");
alert(check);
});
</script>
尽快给出一个字。 Internet Explorer只显示一行并隐藏另一句话。我需要在promopt中显示一个冗长的段落,即。
帮我解决这个问题......
提前致谢。
答案 0 :(得分:2)
IE中没有办法在提示框中扩展文本的长度 - 它只会在2行之后被截断。
唯一可行的替代方法是创建一个带有您自己的文本输入的模态弹出窗口。
IMO,无论如何这是一个更好的解决方案。
答案 1 :(得分:0)
IE的提示无法从javascript更改。我的建议使用jQuery.UI。 sample
<强>示例:强>
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Dialog Sample</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/start/jquery-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
</head>
<body>
<div id="dialog" style="display:none">
this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample this is a sample<br />
<input type="text" id="Check" name="check" value="" />
</div>
<input type="button" id="button" value="Prompt" />
<script type="text/javascript">
$("#button").click(function(){
var check ="";
$("#dialog").dialog({
/* title: "test", */
modal: true,
width: 640,
buttons: {
"Ok": function() {
check = $('#Check:input').val();
$(this).dialog("close");
alert(check);
},
"Cancel": function() {
$('#Check:input').val("");
$(this).dialog("close");
}
}
});
});
</script>
</body>
</html>