简体   繁体   中英

How do I make a textarea work in an iframe cross-browser?

I'm using the following code and the textarea appears, but I can't edit the text in the textarea or even get a blinking cursor to show in Firefox:

<iframe contentEditable='true'; src="you.php"></iframe>

"you.php" is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>
<textarea contentEditable='true';>the text.</textarea>
</body>
</html>

You don't need contentEditable to edit the contents of a textarea. Try this:

<iframe src="you.php"></iframe>

you.php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>
<textarea>the text.</textarea>
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM