I'm trying to create a Javascript button inside PHP that will write innerHTML to a span to overwrite the CSS to change a div from display:none to display:block. (Got that?) So far I just can't get the syntax right. At this point in the code, the div (in red) is correctly hidden but the button does not react at all; it doesn't call the function in a way that writes the span contents. The variables are being filled in via a MySQL table. I included commented-out examples above each code so you know what content I'm expecting.

Code:
while ($arrayArtSizeTOC = mysql_fetch_array($sqlArtSizeTOC)) { 

    $qtyTOC = htmlspecialchars($arrayArtSizeTOC['SUM(article_size)']);
		if ($qtyTOC == '') {$qtyTOC = '0';}

/* Initially hide the detail reports with CSS, the id built of the $i and $ed_i variables to be unique so the span, button, and function all relate */
// <style type="text/css">#displaym1ta { display:none; }</style>
		echo "<style type='text/css'>#displaym" . $i . $ed_i . " { display:none; }</style>";

// A unique-ID span in which to write innerHTML to overwrite the above CSS and show the div.
// <span id="showm1ta"></span>
		echo "<span id='showm" . $i . $ed_i . "'></span>"; 

// The function to call that overwrites the CSS and shows the hidden div
//<script>function showm1ta() {
		echo "<script>function showm" . $i . $ed_i . "() \{";
/* document.getElementById('showm1ta').innerHTML = '<style type="text/css">#displaym1ta{display:block;}</style>'}</script>
*/
		echo "document.getElementById('showm" . $i . $ed_i . "').innerHTML = '<style type=\"text/css\">#displaym" . $i . $ed_i . "\{display:block;\}</style>'\}</script>";

// The button to call the function
		echo "&nbsp;<input type='button' class='button50' value='Breakdown' onclick='showm" . $i . $ed_i . "()'><br>";
// create div to house all the detail reports
		echo"<div id='displaym" . $i . $ed_i . "' style='clear:left; float:left; padding: 0 4em; background-color:#eee;'>";
		echo"<p>TOC article: <strong>". $qtyTOC . "</strong> pages.</p>";
	}