adam@1678: style linktitle adam@1678: style topic adam@1678: adam@1678: fun main () : transaction page = adam@1678: text <- source "Lorem ipsum dolor sit amet"; adam@1678: cls <- source linktitle; adam@1678: return <xml> adam@1678: <head> adam@1678: <title>Dynamic CSS class test</title> adam@1678: <link href="http://adam.chlipala.net/style.css" rel="stylesheet" type="text/css" media="all"/> adam@1678: </head> adam@1678: <body> adam@1678: <dyn signal={t <- signal text; adam@1678: return <xml><div dynClass={signal cls}>{[t]}</div></xml>}/> adam@1678: <div dynClass={signal cls}> adam@1678: <dyn signal={t <- signal text; return (txt t)}/> adam@1678: </div> adam@1678: <button value="Style1" onclick={set cls linktitle}/> adam@1678: <button value="Style2" onclick={set cls topic}/> adam@1678: <ctextbox source={text}/> adam@1678: </body> adam@1678: </xml>