I have enabled trustedtext in the Site rules, because i want to add javascripts in my webpages thanks the MOODLE's HTML editor
1) i typed the following code :
<script language="JavaScript">
function message() {
alert('ok');
}
</script>
<input type='button' value='Click me' onclick='message()'>
then i saved it and run it : it's OK
2) then i wanted modify this web page : the code returned from the DB was :
<script language="JavaScript">&#010;function message() {&#010;alert('ok');&#010;} &#010;</script> <input type="button" onclick="function onclick(event) { message(); }" value="Click me" />
I see the following error in the Firefox's Error console :
http://localhost/course/modedit.php?update=13&return=1

function message() {
alert('ok');#010}
And of course if i try to launch the web page, i got a second error in the FireFox's Console
So, i understood ther is a problem with my LineFeeds converted by a PHP script in HTML entities. Then i deleted the LineFeeds
3) I typed the following code with no blanks :
<script language="JavaScript">function message(){alert('ok');}</script>
<input type='button' value='Click me' onclick='message()'>
This code worked and after recalling the HTML editor the code returned was :
<script language="JavaScript">function message(){alert('ok');}</script> <input type="button" onclick="function onclick(event) { message(); }" value="Click me" />
and i had no error in the Console
But after having saved the ressource, the script didn't work any more !!!!
4) i recall the editor . The code is now :
<script language="JavaScript">function message(){alert('ok');}</script> <input type="button" value="Click me" onclick="function onclick(event) { function onclick(event) { message(); } }" />
So my question is :
If i want to add javascript in a web page thanks to the MOODLE's HTML editor, is it forbitten to reopen this code in this editor ?????
Thanks in adance for your help