문자열 매개 변수로 javascript 메소드 호출이 있습니다. 문자열 텍스트에는 때때로 html 문자 참조가 포함됩니다. '
예기치 않은 식별자 오류가 발생합니다. "
이라는 문자 참조가있는 경우 제대로 작동합니다. 왜 그런지 모르겠습니다. 아래는 내가하려는 일의 코드 스 니펫입니다. 실제 방법은 훨씬 길며 여기에 표시된 것과 다른 것을하려고 시도하지만이 스 니펫은 오류를 재현 할 수 있어야합니다. 내가 오류를 얻을 마우스를 움직일 때Javascript 문자열 참조 (문자 참조 포함)
<script>
function unescapeHTML(html) {
var htmlNode = document.createElement("div");
htmlNode.innerHTML = html;
if(htmlNode.innerText)
alert htmlNode.innerText; // IE
else
alert htmlNode.textContent; // FF
}
</script>
<a class="as_Glossary" onmouseover="unescapeHTML('The manufacturer's sales in dollars to all purchasers in the United States excluding certain exemptions for a specific drug in a single calendar quarter divided by the total number of units of the drug sold by the manufacturer in that quarter'); return true;" onmouseout="hideGlossary(); return true;">Test</a>
는
없습니다를 9와 세미콜론 권리? –
JavaScript 소스 또는 적어도 piecs를 게시 할 수 있습니까? 이것은 고품질의 답변을 상당히 많이 얻을 수있는 시간을 증가시킵니다.) – Juri
감사합니다. Juri, 문제를 보여주기 위해 일부 스 니펫을 추가했습니다. – Eqbal