2014-07-22 3 views
0

나는 바이올린과 같은 편집자를 만들고 있으며 초기 단계에 머물러 있습니다. 내 javascript 내장 함수가 작동하지 않습니다.Html 엔티티 디코드 방법

HTML 코드

<div class="hello"> 
    <p>here is a paragraph</p> 
</div> 
<div class="content-placeholder"></div> 
<div class="hello123"> 
    <a href="#" onclick="myFunction();">Click here!</a> 
</div> 

자바 스크립트 코드 :

function myFunction(){ 
    alert('u r here'); 
} 

내가 HTML과 자바 스크립트를 포함 내 템플릿을 미리 보려면이 양식을 게시. 모든 것은 잘 작동하는 것 같지만 브라우저에서 코드를보기 위해 요소 검사를 클릭하면 javascript가 작동하지 않습니다. 자바 스크립트 함수가 사라지고 대신이 코드가 나타납니다. <a href="#" onclick="myFunction">Click here!</a> onclick 메서드가 사라졌습니다. 컨트롤러에 HTML을 게시하는 동안 html_entities_decode 메서드를 사용하고 있습니다. 나는 codeigniter 프레임 워크를 사용하고있다.

+0

이 아래이 코드는 CodeIgniter의이 포스트 데이터를 살균 함께 할 수있는 뭔가가 있어야합니다. 코드에서 게시물 데이터를 가져 오는 방법을 보여줄 수 있습니까? – budwiser

+0

= $ 데이터 배열 ( \t \t \t \t "USER_ID"=> $ USER_ID, \t \t \t \t 'TEMPLATE_NAME'=> $ this-> 입력 -> 포스트 ('템플레이트 이름') \t \t \t \t 'template_type'=> $ this-> input-> post ('template_type'), \t \t \t \t 'wp_tmp_html'=> htmlentities ($ this-> input-> post ('wp-html-code')) \t \t \t \t 'wp_tmp_css'=> htmlentities ($ this-> input-> p OST ("WP-CSS 코드 ')), \t \t \t \t'wp_tmp_js '=>를 htmlentities ($ this-> 입력 -> 포스트 ('WP-JS 코드 ')) \t \t); 이 데이터 배열을 어떻게 컨트롤러에 게시 오전 –

답변

0

을 제거하십시오. 당신의 onclick..copy에 문자

<div class="hello"> 
    <p>here is a paragraph</p> 
</div> 
<div class="content-placeholder"></div> 
<div class="hello123"> 
     <a href="#" onclick="myFunction()">Click here!</a> 
</div>