Scf.ClientVar() Example
In this example, we add an SCF behavior, then attach the behavior to an HTML element using custom behavior settings.
| Smartsite SXML |
|
|---|---|
<se:placeholder.addjavascript>
$j.scf.behavior.add('TestBehavior', {
attach: function(e,s,j){
alert(s.isAnonymous);
}
});
</se:placeholder.addjavascript>
<button id="testButton">Go</button>
{scf.behavior.attach('#testButton', TestBehavior,
isAnonymous, scf.clientvar(user.isanonymous())
)}
|
|
| Example Result |
|
|---|---|
<script type="text/javascript">
/*<![CDATA[*/
$j.scf.behavior.add('TestBehavior', {
attach: function(e,s,j){
alert(s.isAnonymous);
}
});
$j.scf.behavior.attach('#testButton', 'TestBehavior', {isAnonymous:true});
/*]]>*/
</script>
|
|