Originariamente inviato da 7vite
coma fa a non darti:
Nome "header" non dichiarato ???
questione di classe
...
non sò, ci sarà un qualche errorino nel codice, vedi questo esempio
http://www.raffaellosartori.it/settevite.aspx
il codice è semplicemente questo
codice:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<script runat="server">
sub Page_Load
header.Attributes.Add( "class", "StyleRed" )
end sub
sub red( s as Object, e as EventArgs )
header.Attributes.Add( "class", "StyleRed" )
end sub
sub orange( s as Object, e as EventArgs )
header.Attributes.Add( "class", "StyleOrange" )
end sub
sub black( s as Object, e as EventArgs )
header.Attributes.Add( "class", "StyleBlack" )
end sub
sub green( s as Object, e as EventArgs )
header.Attributes.Add( "class", "StyleGreen" )
end sub
</script>
<!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=iso-8859-1">
<title>Documento senza titolo</title>
<style type="text/css">
<!--
.StyleRed {
height: 96px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FF0000;
}
.StyleOrange {
height: 96px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FF9900;
}
.StyleBlack {
height: 96px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
}
.StyleGreen {
height: 96px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #009966;
}
-->
</style>
</head>
<body>
<form runat="server" id="myForm">
<div id="header" runat="server">
ciao mondo
</div>
<asp:Button ID="btnN" Text="RedStyle" OnClick="red" runat="server" />
<asp:Button ID="btnO" Text="OrangeStyle" OnClick="orange" runat="server" />
<asp:Button ID="btnB" Text="BlackStyle" OnClick="black" runat="server" />
<asp:Button ID="btnG" Text="GreenStyle" OnClick="green" runat="server" />
</form>
</body>
</html>