1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <!-----------BLOC NOTE------------->
<form style="position: absolute; width: 339px; right: 0;" id="formulaireCSS3">
<label style="font-size: 15px; top: -7px; left: 130px;" for="textarea">Bloc-note :</label>
<textarea id="textarea" name="textarea" cols="40" rows="40"><?php
if(!($fp = fopen("private/blocnote.txt","r")))
{
echo "Echec de l'ouverture du fichier";
exit;
}
while(!feof($fp))
{
// On récupère une ligne
$ligne = fgets($fp,255);
// On affiche la ligne
echo $ligne;
}
fclose($fp); // On ferme le fichier
?></textarea>
<div id="chargement">
<input style="position: relative; top : -5px; left: 138px; margin: 3px;" type="button" value="save" id="createNew" onclick="editBlocnote();"/>
<img id="imgChargement" style="position: relative; top : -5px; left: 154px; margin-bottom: 1px; display: none;" src="images/chargement.gif"/>
</div>
</form>
<script>
//On l'edit :
function editBlocnote()
{
//$('chargement').innerHTML = '<img style="position: relative; top : -5px; left: 154px; margin-bottom: 1px;" src="images/chargement.gif"/>';
$('createNew').style.display = "none";
//$$('#chargement > img').style.display = "block"; //ne fonctionne pas oO
$('imgChargement').style.display = "block";
var params = 'text=' + $('textarea').value;
new Ajax.Request
(
"request/editBlocnote.php",
{
method: 'post',
parameters: params,
onComplete: function(transport)
{
setTimeout("updateButton()", 500);
}
}
);
}
function updateButton()
{
//$('chargement').innerHTML = '<input style="position: relative; top : -5px; left: 138px; margin: 3px;" type="button" value="save" id="createNew" onclick="editBlocnote();"/>';
$('imgChargement').style.display = "none";
$('createNew').style.display = "block";
}
createOnkeydown();
function createOnkeydown()
{
document.onkeydown = function(e)
{
if(e.ctrlKey && e.keyCode==83 && $('createNew') != null)
{
(navigator.appName.substring(0,3)=="Mic") ? event.returnValue = false : e.preventDefault();
editBlocnote();
}
}
}
</script>
<!-----------------------------------> |