8.7w+
社区成员
document.getElementById("vir").action="<c:url value="/back/main/saveVirus.jspx"/>";
document.getElementById("vir").submit();
报错,对象不支持此属性或方法,但是在火狐下面就没有,完整代码如下
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/syscommon/taglib_inc.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>病毒信息</title>
<link href="${contextPath}/webapp/back/css/bid.css" rel="stylesheet" type="text/css">
<link href="${contextPath}/webapp/style/calendar.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function check()
{
var content=document.getElementById("content");
if(content.value=='')
{
alert("内容不能为空!");
content.focus();
return;
}
var action=document.getElementById("action");
if(action.value=='add')
{
document.getElementById("vir").action="<c:url value="/back/main/addVirus.jspx"/>";
document.getElementById("vir").submit();
}
else if(action.value=='save')
{
document.getElementById("vir").action="<c:url value="/back/main/saveVirus.jspx"/>";
document.getElementById("vir").submit();
}
}
</script>
</head>
<body>
<form action="" name="vir" id="vir" method="post">
<br/>
<p align="center"><font style="size: 15px; color: #1166B6; font-weight: bold;"> 什么是病毒: </font></p>
<br/>
<br/>
<div style="width:100%;" style="text-align: center;">
<input type="hidden" name="id" id="id" value='${map.text.id }'/>
<input type="hidden" name="action" id="action" value='${map.action }'/>
<table border="0" cellpadding="0" cellspacing="0" style="font-size: 13px; ">
<tr>
<td> 内容:</td>
<td>
<textarea id="content" name="content" rows="25" cols="70">${map.text.content }</textarea>
</td>
</tr>
<tr>
<td id="subBtn" height="40" colspan="2" valign="middle" align="center" >
<a href="#" onclick="check();">提交</a>
<a href="#" onclick="window.history.go(-1)">返回</a>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>