已经定义好的style,如果想更改内容的话,应该如何做呢
以下是个简单的范例
以下是个简单的范例
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<style id=wstyle>
.txt1{background-Color:skyblue}
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function button1_onclick() {
//window.alert(window.document.styleSheets[0].rules('txt1').style.backgroundColor);
window.document.styleSheets[0].rules('txt1').style.backgroundColor='yellow';
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM action="" method=POST id=form1 name=form1>
<%for y = 1 to 10%>
<INPUT type="text" id=text1 name=text1 class=txt1><br>
<%Next%>
<INPUT type="button" value="Button" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()">
</FORM>
</BODY>
</HTML>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<style id=wstyle>
.txt1{background-Color:skyblue}
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function button1_onclick() {
//window.alert(window.document.styleSheets[0].rules('txt1').style.backgroundColor);
window.document.styleSheets[0].rules('txt1').style.backgroundColor='yellow';
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM action="" method=POST id=form1 name=form1>
<%for y = 1 to 10%>
<INPUT type="text" id=text1 name=text1 class=txt1><br>
<%Next%>
<INPUT type="button" value="Button" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()">
</FORM>
</BODY>
</HTML>
Microsoft MVP ASP/ASP.NET |
topcat |
浙公网安备 33010602011771号