!--a11y-->
Dynamically Changing Attributes 
A toggle button needs to be activated and deactivated for the alternate table styles. The toggle button style changes according to the currently set attribute (ALT_STYLES) for the table.
To do this, a toggle button is created in HTML. The style class for the toggle button is set dynamically.
<!-- BW data source object tags -->
<object>
<param name="OWNER" value="SAP_BW">
<param name="CMD" value="SET_DATA_PROVIDER">
<param name="NAME" value="DATAPROVIDER_1">
<param name="DATA_PROVIDER_ID" value="">
DATA_PROVIDER: DATAPROVIDER_1
</object>
<object>
<param name="OWNER" value="SAP_BW">
<param name="CMD" value="SET_PROPERTIES">
<param name="TEMPLATE_ID" value="EXAMPLE_TEMPLATE_1 ">
TEMPLATE PROPERTIES
</object>
<HTML>
<HEAD>
<TITLE>Example Template 1</TITLE>
<link href= "/sap/bw/mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
<!--
/* This function switches the attribute ALT_STYLES (alternate Tablestyles) for item mytable
1. Get actual value for attribute ALT_STYLES
2. Send Commando with new attribute to BW Server */
function switch_table_style(mytable) {
var prop = SAPBWGetItemProp(mytable);
var table_style='X';
if (prop != null){
for(i=1;i<prop.length;i++){
if (prop[i][0] == "ALT_STYLES") table_style = prop[i][1];
}
}
if (table_style =='X') {
table_style=' '
}
else
table_style = 'X';
SAPBWOpenURL(SAP_BW_URL_Get() +'&item=' + mytable +'&alt_styles=' + table_style);
}
/* function to set the correct button style for button mybutton depending on
ALT_STYLES attribute for item mytable
1. Get actual value
for attribute ALT_STYLES for table mytable
2. Change class
Attribute for button mybutton*/
function set_button(mytable, mybutton) {
var prop = SAPBWGetItemProp(mytable);
var table_style='X';
if (prop != null){
for(i=1;i<prop.length;i++){
if (prop[i][0] == "ALT_STYLES") table_style = prop[i][1];
}
}
if (table_style !='X') {
document.getElementById(mybutton).setAttribute('className', 'SAPBEXBtnEmph','false');
}
}
-->
</script>
</HEAD>
<BODY>
<P><object>
<param name="OWNER" value="SAP_BW">
<param name="CMD" value="GET_ITEM">
<param name="NAME" value="TABLE_1">
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID">
<param name="DATA_PROVIDER" value="DATAPROVIDER_1">
<param name="GENERATE_CAPTION" value="">
<param name="WIDTH" value="399">
ITEM: TABLE_1
</object></P>
<!-- Include a button in HTML with id mybutton1. By clicking on link the function switch_table_style for item TABLE_1 will be executed -->
<table class="SAPBEXBtnStdBorder" cellspacing="0" cellpadding="0" border="0"><tr><td>
<table>
<tr>
<td class="SAPBEXBtnStd" id="mybutton1"><A href="javascript:switch_table_style('TABLE_1');">Alternate Styles</A>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- call function set_button, to set the correct style class for button mybutton1-->
<script type="text/javascript">
<!--
set_button('TABLE_1', 'mybutton1');
-->
</script>
</BODY>
</HTML>

If you copy the code from the example, make the following changes in the formatting:
· Remove the space between the character ‘=’ and ‘”’ in the BW object tags.
· Make sure that the character string for HTML comments is set correctly. Before ‘<! ‘ (Beginning of HTML comment) or before ‘>’ (end of HTML comments) there should be two minus signs / hyphens (--).
