Con l inizio della creazione del webeditor sono sorti anche i primi problemi....cliccando su corsivo non mi effettua nessuna modifica al font..
Codice PHP:
<html>
<head>
<LINK href="stile2.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript">
function load(){
AttivaFrame("editArea").designMode = "On";
}
function AttivaFrame(editArea){
if (document.getElementById(editArea).contentDocument){
//Mozilla
return document.getElementById(editArea).contentDocument;
} else {
//Internet Explorer
return document.frames[editArea].document;
}
}
function applicaCorsivo(){
AttivaFrame('editArea').execCommand('italic',false, null);
}
</script>
<body>
<div id="form">
<?php
//Apro la sessione e...
session_start();
// Sessione impostata a 10 min
ini_set('session.gc_maxlifetime', '1800');
//verifico che dopo il login io abbia la chiave di sessione ad 1
if($_SESSION['logged']==1)
//se si...
include "config.php"; // file di connessione al Db
else "Devo loggarti"; // file di connessione al Db
//mi collego alla tabelle che contiene i nick bannati
if(mysql_num_rows(mysql_query("SELECT bannato FROM minichat WHERE bannato = 'id_user'")) > 0)
die('Sei bannato');
else {
echo "
<body onload=\"load()\">
<form action=\"index.php\" name=\"chat\" method=\"POST\">
<textarea rows=\"2\" id=\"editArea\" name=\"text\" cols=\"26\"></textarea>
<input type=\"button\" value=\"corsivo\" id=\"corsivo\" onclick=\"applicaCorsivo()\"/>
<div id=\"invia\"><input type=\"submit\" value=\"Invia\"></div>
<img src=\"faccine/smile.gif\" OnClick=\"document.chat.text.value+=':-)'\">
<img src=\"faccine/faccia.gif\" OnClick=\"document.chat.text.value+=':-+'\">"
;
}?>
</div></form>
Clicco su corsivo ma nn fa nulla..come mai? :berto:
nell esempio tratta di un iframe mentre io devo agire su una textarea...quindi ho messo l id della textarea ma nn funziona..