Created
April 15, 2013 03:21
-
-
Save rpgmaker/5385480 to your computer and use it in GitHub Desktop.
Razor JS with codeblock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type='text/javascript'> | |
var Html = (function(){ | |
var content = jQuery('<div>'); | |
function _write(html){ | |
content.append(html); | |
} | |
function _clear(){ | |
content.html(''); | |
} | |
function _flush(){ | |
jQuery(document).append(content); | |
_clear(); | |
} | |
return { | |
Write: _write, | |
Flush: _flush | |
}; | |
})(); | |
(function(){ | |
Html.Write(' | |
'); | |
var moo = 'test'; | |
var foo = 'foo'; | |
var fooFunc = function(x){ | |
foo = x; | |
} | |
Html.Write(' | |
<br/> | |
'); | |
Html.Write('<span data-id=\'_1\'></span>'); | |
function _1(){ return Button.Create(function(s) { s.Text(moo); }) ; } | |
jQuery("span[data-id='_1']").html(_1()); | |
Html.Write(' | |
'); | |
}).apply(Html)(); | |
Html.Flush(); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
var moo = 'test'; | |
var foo = 'foo'; | |
var fooFunc = function(x){ | |
foo = x; | |
} | |
} | |
<br/> | |
@Button.Create(function(s) { s.Text(moo); }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment