我有一张表格:
<form name="green" class="form-inline" onchange="javascript:send_choose()" enctype="multipart/form-data">
<br><br>
<div>
<input type="text" class="form-control" style="width:100%;" name="linkgreen" id="linkgreen" placeholder="some example"> <br> <br>
</div>
</form>
JS在底部:
<script language="JavaScript" type="text/javascript" src="js/jquery-1.11.1.min.js">
function send_choose() {
event.preventDefault();
var link = document.getElementById('linkgreen');
$.ajax({
type: 'POST',
url: 'include/create_file.php',
data: {
name4: 'weblink.txt',
link: link.value
},
});
$('input[type="text"]').attr('disabled', 'disabled');
$('input[type="submit"]').attr('disabled', 'disabled');
};
$(document).ready(function () {});
</script>
它完全适用于Chrome和IE,但在Mozilla中无效。
答案 0 :(得分:0)
试试这个,它会为你的代码分隔jquery包含<script>
标记和<script
标记,这是正确的做事方式,你从未做过的事情:
<script language="JavaScript" type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script>
function send_choose() {
event.preventDefault();
var link = document.getElementById('linkgreen');
$.ajax({
type: 'POST',
url: 'include/create_file.php',
data: {
name4: 'weblink.txt',
link: link.value
},
});
$('input[type="text"]').attr('disabled', 'disabled');
$('input[type="submit"]').attr('disabled', 'disabled');
};
$(document).ready(function () {});
</script>