Grafische gevorderde |
|
Let aub niet op de codering.. die is slecht atm tis alleen maar om te testen!
Maar het volgende script.. zet als je zeg maar een hele site kopieert.. alles om naar de broncode. Maar dit werkt echter alleen in IE.. weet iemand hoe ik dit in FF werkend kan maken?
<div style="visibility:hidden;width:0px;height:0px" onbeforepaste=fnBeforePaste() oncontextmenu='disable=true' id="theMainText" contenteditable></div>
<div id=cont style="visibility:hidden;display:none;width:0px;height:0px;overflow:hidden;"> </div>
<form name="addProvince" action="" method="post">
<table cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<textarea name="content" rows="12" cols="60" onbeforepaste=fnBeforePaste() oncontextmenu="disable=true"></textarea>
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Rip Content" />
</td>
</tr>
</table>
</form>
<script>
disable=false
var current,cont;
function fnPaste()
{
cont.style.display="none";
var html=cont.innerHTML;
//html="<b>"+html+"</b>";
//alert(html);
document.forms["addProvince"].elements["content"].value = html;;
//document.forms["addProvince"].submit();
//current.pasteHTML(html);
//current.select();
}
function fnBeforePaste()
{
if ( disable == false )
{
//alert()
// this is where i need the clipboard data WITH formating
current=document.selection.createRange();
sel=document.body.createTextRange();
cont=document.getElementById("cont");
cont.style.display="inline";
sel.moveToElementText(cont);
sel.select();
setTimeout("fnPaste()",100);
}
else
{
disable = true
return false
}
}
</script>
<div style="visibility:hidden;width:0px;height:0px" onbeforepaste=fnBeforePaste() oncontextmenu='disable=true' id="theMainText" contenteditable></div> <div id=cont style="visibility:hidden;display:none;width:0px;height:0px;overflow:hidden;"> </div> <form name="addProvince" action="" method="post"> <table cellpadding="0" cellspacing="0"> <tr> <td align="center"> <textarea name="content" rows="12" cols="60" onbeforepaste=fnBeforePaste() oncontextmenu="disable=true"></textarea> </td> </tr> <tr> <td align="center"> <input type="submit" value="Rip Content" /> </td> </tr> </table> </form> <script> disable=false function fnPaste() { cont.style.display="none"; var html=cont.innerHTML; //html="<b>"+html+"</b>"; //alert(html); document.forms["addProvince"].elements["content"].value = html;; //document.forms["addProvince"].submit(); //current.pasteHTML(html); //current.select(); } function fnBeforePaste() { if ( disable == false ) { //alert() // this is where i need the clipboard data WITH formating current=document .selection .createRange (); sel=document.body.createTextRange(); cont=document.getElementById("cont"); cont.style.display="inline"; sel.moveToElementText(cont); sel.select(); setTimeout("fnPaste()",100); } else { disable = true return false } } </script>
|