要するに、書いたHTMLがそれっぽく見えればWYSIWYGってわけですよね。
じゃあ、書いたものをそのままブラウザ表示すりゃいいわけじゃないですか。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
textarea, | |
div#results | |
{ | |
width:1500px; | |
height:460px; | |
} | |
</style> | |
<script src="../includes/scripts/js/lib/jquery-1.7.2.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() | |
{ | |
$("textarea").keyup(function(){ | |
$("div#results").html($("textarea").val()); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="results"> | |
</div> | |
<form action="editor.php"> | |
<textarea name="text"> | |
</textarea> | |
</form> | |
</body> | |
</html> |
適宜 HTMLコードを入力してみましょう。
画面上部に結果が表示されます。
リアルタイムでHTMLコードが編集できます。
ちょっとしたプレビューにも使えます。