jsf页面中嵌入js代码,总是提示函数未定义
jsf页面:<htmlxmlns=http://www.w3.org/1999/xhtml...<ui:definename="header.includes"><scr...
jsf页面:
<html xmlns=http://www.w3.org/1999/xhtml
...
<ui:define name="header.includes">
<script type="text/javascript">
function outtest(){
var test = document.getElementById("viewlbl");
var strtest = "<p>Browser:" + navigator.userAgent + "</p>" +
"<p>offsetWidth:" + test.offsetWidth + "</p>" +
"<p>offsetHeight:"+test.offsetHeight+"</p>"+
"<p>offsetLeft:"+test.offsetLeft+"</p>"+
"<p>offsetTop:"+test.offsetTop+"</p>");
var outlabel = document.getElementById("showoffset");
outlabel.value = strtest;
outlabel.render = true;
return true;
}
</script>
</ui:define>
......
<ui:define name="body">
<div id="test">
<h:commandButton value="outtestT" onclick="outtest()">
</h:commandButton>
<h:outputLabel id="showoffset" />
</div>
</ui:define>
......
</html>
错误提示:“outtest”未定义 展开
<html xmlns=http://www.w3.org/1999/xhtml
...
<ui:define name="header.includes">
<script type="text/javascript">
function outtest(){
var test = document.getElementById("viewlbl");
var strtest = "<p>Browser:" + navigator.userAgent + "</p>" +
"<p>offsetWidth:" + test.offsetWidth + "</p>" +
"<p>offsetHeight:"+test.offsetHeight+"</p>"+
"<p>offsetLeft:"+test.offsetLeft+"</p>"+
"<p>offsetTop:"+test.offsetTop+"</p>");
var outlabel = document.getElementById("showoffset");
outlabel.value = strtest;
outlabel.render = true;
return true;
}
</script>
</ui:define>
......
<ui:define name="body">
<div id="test">
<h:commandButton value="outtestT" onclick="outtest()">
</h:commandButton>
<h:outputLabel id="showoffset" />
</div>
</ui:define>
......
</html>
错误提示:“outtest”未定义 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询