我有这段代码。JavaScript中的dwoo模板变量?
{if $loginUrl}
{literal}
<script type="text/javascript">
var newwindow;
var intId;
function login() {
var screenX = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
screenY = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
width = 500,
height = 270,
left = parseInt(screenX + ((outerWidth - width)/2), 10),
top = parseInt(screenY + ((outerHeight - height)/2.5), 10),
features = (
'width=' + width +
',height=' + height +
',left=' + left +
',top=' + top
);
newwindow=window.open('{$loginUrl}','Login by facebook',features);
if (window.focus) {newwindow.focus()}
return false;
}
</script>
{/literal}
{/if}
这是dwoo模板,我不知道我怎么可以在JavaScript内使用我的dwoo变量?即时尝试只是在你可以看到的代码,但它不工作。我需要在{literal}之间转换我的代码,以便它可以工作。
不知道dwoo什么,但假设这是一个服务器端事情,可能类似于'val somevar =“{$ somevar}”;' – Jonah 2010-05-19 04:16:50