如果表单已提交但未通过任何特定按钮提交,例如
HTMLFormElement.submit()在JS中使用浏览器应该如何确定多个提交按钮中的哪一个(如果有的话)用作按下的按钮?
这在两个层面上很重要:
onclick附加到提交按钮的事件处理程序到目前为止,我的实验表明:
标准说什么?
如果它会有所帮助,这是我的测试代码(PHP仅与我的测试方法相关,而不是我的问题本身)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<h1>Get</h1>
<dl>
<?php foreach ($_GET as $k => $v) echo "<dt>$k</dt><dd>$v</dd>"; ?>
</dl>
<h1>Post</h1>
<dl>
<?php foreach ($_POST as $k => $v) echo "<dt>$k</dt><dd>$v</dd>"; ?>
</dl>
<form name="theForm" method="<?php echo isset($_GET['method']) ? $_GET['method'] : 'get'; ?>" action="<?php echo …Run Code Online (Sandbox Code Playgroud) 鉴于:
console.log(boo); this outputs undefined
Run Code Online (Sandbox Code Playgroud)
鉴于:
var boo = 1;
console.log(boo); this outputs 1
Run Code Online (Sandbox Code Playgroud)
在定义boo并设置为1后,如何重置boo,以便console.log输出undefined?
谢谢
我正在尝试使用jQuery文件上传演示.我已经搜索了wiki和模板引擎wiki但是找不到如何在不使用表格行标签的情况下自定义上传/下载模板的答案.每次我删除/更改表行标记它都不起作用.
Bellow是我自定义的上传模板,它不起作用.我不知道为什么,有人可以帮忙吗?
uploadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<li class="span3"><div class="thumbnail template-upload">' +
'<div class="preview"><span></span></div>' +
'<div class="caption"><h5 class="name"></h5>' +
'<p class="size"></p>' +
(file.error ? '<div class="error" colspan="2"></div>' :
'<div><div class="progress">' +
'<div class="bar" style="width:0%;"></div></div></div>' +
'<div class="start"><button>Start</button></div>'
) + '<div class="cancel"><button>Cancel</button></div></div></div></li>');
row.find('.name').text(file.name);
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.error').text(
locale.fileupload.errors[file.error] || file.error
);
}
rows = rows.add(row);
});
return rows;
},
Run Code Online (Sandbox Code Playgroud) 我使用jQuery File Upload Basic Plus Ui来处理多个上传文件.我需要以多种语言(英语,法语和西班牙语)显示错误消息,但我不知道如何创建
messages: {
maxNumberOfFiles: 'Maximum number of files exceeded',
acceptFileTypes: 'File type not allowed'
maxFileSize: 'File is too large',
minFileSize: 'File is too smal
}
Run Code Online (Sandbox Code Playgroud)
多种语言以及如何声明语言
file.error = settings.i18n('acceptFileTypes');
Run Code Online (Sandbox Code Playgroud)
使用演示版本,错误消息显示正常.
谢谢