<form name=form1 action="deletecard.asp"
onsubmit="return confirm('确认要删除吗?')">
<input type=text>
<input type=submit value="Submit">
</form>//这样就行了.
//不用再退回,因为,
//如果你按取消时,就不会提交..
//你自己试试看吧.
onsubmit="return confirm('确认要删除吗?')">
<input type=text>
<input type=submit value="Submit">
</form>//这样就行了.
//不用再退回,因为,
//如果你按取消时,就不会提交..
//你自己试试看吧.
if(confirm("Are You Sure??"))
location="deletecard.asp"
else
history.back()
</script>你要注意一下你的代码运行的环境
response.redirect("deletecard.asp")分明是asp语法,也就是服务器端脚本,根本不能用msgbox之类的对话框方法,而且,对于服务器端脚本,何来history????
你取消关闭以后 , 你表单的内容默认就是保存的 。 。 。
if(confirm(""))
{}
else
{}
他是window对象的方法 ,
和alert,showModalDialog,prompt
一样
window对象不是javascript的内容,有人想争辩吗?
你可以用vbs和js两种脚本调用cofirm,alert,showModalDialog 而且window可以省略。
<SCRIPT LANGUAGE=vbs>
window.confirm "ok?"
window.alert "ok?"
window.showModalDialog "ok.htm"
window.prompt "ok?"
</SCRIPT>
javascript内部没有类似msgbox函数和InputBox函数的功能参考:confirm--------------------------------------------------------------------------------DescriptionDisplays a Confirm dialog box with the specified message, and OK and Cancel buttons. Syntax
object.confirm([message])Parameter Description
message Optional. (String) String to display. Return ValueReturns TRUE if the user chooses OK, or FALSE if the user chooses Cancel. ResYou have no control over the dialog box title. Applies Towindow jscript只有16个内部对象
下表列出了 JScript 对象:描述 语言元素
启用并返回一个 Automation 对象的引用。 ActiveXobject 对象
提供对创建任何数据类型的数组的支持。 Array 对象
创建一个新的 Boolean 值。 Boolean 对象
提供日期和时间的基本存储和检索。 Date 对象
存储数据键、项目对的对象。 Dictionary 对象
提供集合中的项的枚举。 Enumerator 对象
包含在运行 JScript 代码时发生错误的有关信息。 Error 对象
提供对计算机文件系统的访问。 FileSystemobject 对象
创建一个新的函数。 Function 对象
是一个内部对象,目的是将全局方法集中在一个对象中。 Global 对象
一个内部对象,提供基本的数学函数和常数。 Math 对象
表示数值数据类型和提供数值常数的对象。 Number 对象
提供所有 JScript 对象的公共功能。 object 对象
存储有关正则表达式模式查找的信息。 RegExp 对象
包含一个正则表达式模式。 正则表达式对象
对文本字符串进行操作和格式处理,判定在字符串中是否存在某个子字符串及确定其位置。 String 对象
提供对 Visual Basic 安全数组的访问。 VBArray 对象
FileSystemobject 对象
Dictionary 对象
RegExp 对象
也不能算真正的内部
因为其他脚本语言一样访问,他们来自组件。
variant = object.showModalDialog(sURL [, vArguments [, sFeatures]])Parameter Description
sURL String specifying the URL of the document to load and display. While an empty string is accepted (""), it should be noted that this is useless since once a modal dialog has been opened, it cannot be accessed by the page that opened it.
vArguments Optional. Variant specifying the arguments to use when displaying the document. This parameter can be used to pass a value of any type including an array of values. The dialog can extract the values passed by the caller from the dialogArguments property of the window object.
sFeatures Optional. String specifying the window ornaments for the dialog box. It can be a combination of the following values. Syntax Description
dialogWidth:number Sets the width of the dialog window.
dialogHeight:number Sets the height of the dialog window.
dialogTop:number Sets the top position of the dialog window relative to the upper-left corner of the desktop.
dialogLeft:number Sets the left position of the dialog window relative to the upper-left corner of the desktop.
center:{yes | no | 1 | 0 } Specifies whether to center the dialog window within the desktop. Default is yes.
Return ValueReturns a number, string, or other value. This is equal to the value of the returnValue property as set by the document given by URL. ResThe default font settings should be set in the same way CSS attributes are set; for example, "font:3;font-size:4". To define multiple font values, use multiple font attributes. When dialogLeft and/or dialogTop is specified, the feature center is overridden, even though the default for center is yes.Applies Towindow
我吐血中......
那也要看什么场合。
JS绝对适合浏览器客户断的脚本开发,功能强大,
只不过是你不精通罢了。你只精通vbs等你精通了
JS之后你就会觉得JS原来功能也非常强大
ParameterssMessage Optional. String that specifies the message to display in the confirmation dialog box. If no value is provided, the dialog box does not contain a message. Return ValueBoolean. Returns one of the following possible values:true The user clicked the OK button.
false The user clicked Cancel button.