scusate davvero... ma non ne vengo a capo...
Ho una pagina html dove cliccando sul testo mi apre una popUp , li posso cambiare il testo e cliccando su aggiorna il testo cambia.
Nella popUp ho un avvertimento che se clicco su una zona non pertinente mi avvisa che non ho selezionato del testo.
Bene mi funziona solo su Pc e solo con opera.
Il mio proposito e' di usarlo almeno su qualche browser oltre che opera... (tipo firefox xplorer o su macintosh ecc)
aiutino...? :-)
grazie a voi
federico mora
codice html--------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="copyright" title="copyright" />
<script type="text/javascript" language="javascript" src="compiler.js"></script>
</head>
<body>
<div id="prepage">
<div id="page">
<div id="main">
<div id="lc">
<div class="article main">
<h1>argomento titolo argomento</h1>
Integer purus. Mauris scelerisque justo eu tortor. Curabitur blandit leo
at neque. Morbi porttitor tortor sed dui. In lacinia. Aliquam erat volutpat.
. Cras erat.
</p>
</div>
</div>
</div>
</div> </div>
</body>
</html>
codice popUp (file editor.htm)--------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Finestra di Editing testi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
@import url("editor.css");
-->
</style>
</head>
<body>
<h1>Scrivi i nuovi contenuti</h1>
Aggiorna
<form>
<textarea onchange="javascript:window.document.newcontent=th is.value;">[Nessun elemento selezionato per l'editing. Chiudere questa finestra prima di selezionare un nuovo elemento.]</textarea>
</form>
</body>
</html>
codice css (popUp dell'editor css)-------------
/* CSS Document */
body {
background: #E0E0E0;
color: #000;
font-family: "trebuchet MS", Arial, Helvetica, sans-serif;
font-size: small !important;
font-size /**/: x-small;
}
textarea {
width: 100%;
height: 85% !important;
height: 13em;
clear: both;
}
input {
width: 100%;
}
a {
color: #090;
font-weight: bold;
}
h1 {
color: #888;
margin: 0; padding: 0;
margin-right: 1em;
font-size: large !important;
font-size /**/: medium;
float: left;
}
codice Js (file compiler.js)-----leggermente accorciato...----------
// JavaScript Document
window.onload=function() {
if(document.getElementsByTagName) {
a_h1=document.getElementsByTagName("h1");
a_p=document.getElementsByTagName("p");
for(var j=0; j<a_h1.length; j++) {
a_h1[j].onclick=function() {
edit(this);
}
}
for(var j=0; j<a_p.length; j++) {
a_p[j].onclick=function() {
edit(this);
}
}
}
}
function edit(arg) {
win=window.open("editor.htm", "nuova", "width=400, height=500, toolbars='no'");
repArray=new Array("<SPAN CLASS=\"foto2\"><IMG SRC=\"file://localhost/", "<SPAN CLASS=\"foto1\"></SPAN>", "
", "", "", "", "", "<U>", "</U>");
substArray=new Array("[img dx]", "[img dx out]", "[img sx]", "[img sx out]", "[/img]", "\r\n", "[g]", "[/g]", "", "", "", "");
var oldcontent=arg.innerHTML.split("\t").join("").spli t("\r\n").join("");
for(var k=0; k<repArray.length; k++) {
oldcontent=oldcontent.split(repArray[k]).join(substArray[k]);
}
var tarea=win.document.getElementsByTagName("textarea" )[0];
tarea.firstChild.nodeValue=oldcontent;
var button=win.document.getElementById("button");
button.onclick=function() {
var mynewcontent=win.document.newcontent;
for(var k=0; k<substArray.length; k++) {
mynewcontent=mynewcontent.split(substArray[k]).join(repArray[k]);
}
arg.innerHTML=mynewcontent;
}
}