eclipse中使用struts框架
作者:互联网
test1.jsp
<%@ page language="java" contentType="text/html; UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix = "bean" uri = "struts-bean" %>
<%@ taglib prefix = "html" uri = "struts-html" %>
<%@ taglib prefix = "logic" uri = "struts-logic" %>
<%@ taglib prefix = "template" uri = "struts-template" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<!--
<div class="button-text">buttonタグ</div>
<button type="button" onclick="change()" disabled>テキスト変更</button>
<input type="text" disabled>
-->
<div>メールアドレス</div>
<input type = "text" id = "mailAddress" disabled><br>
<input type = "checkbox" id = "checkBox1" value="" onchange= "change2()"><span>広告を受け取る</span><br>
<input type="image" src="<html:rewrite page="/img/good.png" />" id="send" alt="送信">
</body>
</html>
js/sample.js
/**
*
*/
function change() {
var elements = document.getElementsByClassName("button-text");
elements[0].innerHTML = "テキストが変更されました。"
}
function change2() {
var element;
if (document.getElementById("checkBox1").checked) {
element = document.getElementById("mailAddress");
element.disabled = false;
} else {
element = document.getElementById("mailAddress");
element.disabled = true;
}
}
标签:function,elements,框架,struts,eclipse,element,getElementById,var,document 来源: https://blog.csdn.net/djydjy3333/article/details/123070330