<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<input type="text" id="txt" />
<button onclick="fun()">click</button>
<script type="text/javascript">
function fun()
{
document.getElementById("txt").value = "你设定的内容";
}
</script>
</body>
</html>

解决方案 »

  1.   

    我要显示的内容是一段视频代码,不是几个文字该怎么办呢?
    代码如下:
    <object align=middle classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class=OBJECT id=MediaPlayer width=196 height=196>
    <param name=ShowStatusBar value=0>
    <param name=Filename value="http://202.116.*.*/video/story/chinese/hynh/b.wmv">
    <embed type=application/x-oleobject codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">
    </embed>
    </object>
      

  2.   

    你可以将你的这些视频代码赋值个一个变量。
    <!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
    </head>
    <body>
    <input type="text" id="txt" />
    <button onclick="fun()">click</button>
    <script type="text/javascript">
    function fun()
    {
        var v="你的视频代码,注意将替换符号";
        document.getElementById("txt").value = v;
    }
    </script>
    </body>
    </html>
      

  3.   


    <!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
    </head>
    <body>
    <textArea  id="areaExp" rows="10" cols="50">
    </textArea >
    <p>
    <button onclick="fun()">click</button>
    <script type="text/javascript">
    function fun()
    {
        var exp = '<object align=middle classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class=OBJECT id=MediaPlayer width=196 height=196><param name=ShowStatusBar value=0><param name=Filename value="http://202.116.*.*/video/story/chinese/hynh/b.wmv"><embed type=application/x-oleobject codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"></embed></object>';
        var v="你的视频代码,注意将替换符号";
        document.getElementById("areaExp").value = exp;
    }
    </script>
    </body>
    </html>