view tests/doubleDyn.ur @ 1908:ab1a3737b306

make clean: Clean bin/mlton, src/urweb.mlton.lex, src/urweb.mlton.grm Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
author Anders Kaseorg <andersk@mit.edu>
date Fri, 22 Nov 2013 09:36:14 -0500
parents d05299e561c8
children
line wrap: on
line source
style linktitle
style topic

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