Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIY Html Editor #26

Open
uniquejava opened this issue Feb 21, 2016 · 0 comments
Open

DIY Html Editor #26

uniquejava opened this issue Feb 21, 2016 · 0 comments

Comments

@uniquejava
Copy link
Owner

测试代码
参考: http://blog.csdn.net/dongzhiquan/article/details/5851201

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="javascript/jquery-1.10.2.min.js"></script>
</head>
<body>
<iframe id="htmlEdit" marginheight="1" marginwidth="1" width="100%" height="321"></iframe>

<script>
    var editor = $('#htmlEdit').get(0).contentWindow;
    var doc = editor.document;
    doc.designMode = 'on'; // 到这一步就已经变成textarea了..
    doc.contenteditable = true; //这个属性好酷, 参见http://www.w3school.com.cn/html5/att_global_contenteditable.asp
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant