Access function inside CDATA
I have the following code in my ASP.net application js:
//<![CDATA[
function GetQuestionErrors()
{
//Some code开发者_JS百科
}
var myclientvariable=null;
//]]>
function calValue()
{
var data=GetQuestionErrors();//Registered function in code behind C#
}
When control comes to var data=GetQuestionErrors();
it throws an error 'Object expected'. Please assist me to solve this issue.
Commented CDATA tags inside script tags hasn't been needed since netscape 1. For ASP pages, they might be required though, but more like this:
<![CDATA[
<script>
// code
</script>
]]>
Or equivalent.
In otherwords, the JavaScript does not need to be escape in JavaScript runtime.
精彩评论