StyleSheet Utilityを使ってCSS値を文字列に変換する
YAHOO.util.StyleSheet.toCssTextでCSSを示すハッシュをCSSの文字列に変換できます。
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo/yahoo-min.js" ></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/stylesheet/stylesheet-min.js"></script> <script type="text/javascript"> function onLoad() { // CSSを示す文字列を得る var cssString = YAHOO.util.StyleSheet.toCssText( { width: "100px", height: "1000px", backgroundColor : "#FF3333" }); document.getElementById("stdout").innerHTML = cssString; } </script> </head> <body onload="onLoad();"> <div id="stdout"></div> </body> </html>