运行效果:

浏览器编辑HTML

test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


HTML源码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>浏览器编辑HTML</title>
<script language="JavaScript" type="text/JavaScript">
//运行文本域代码
function runEx(cod1) {
cod=document.all(cod1)
var code=cod.value;
if(code==""){
alert('内容为空,请输入内容!');
}
if (code!=""){
var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。
newwin.opener = null // 防止代码对论谈页面修改
newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
newwin.document.close();
}
}
function quickdelete(cod2){
cod=document.all(cod2)
var code=cod.value;
if(code==""){
alert('无需重复点击,内容已经为空!');
}
document.getElementById(cod2).value ="";
}
</script>
<style type="text/css">
.boxes{
text-align: left;
font-size: 18px;
width: 1150px;
height: 400px;
color: #4d90fe;
font-weight: bold;
margin-left: 100px;
background: #f3f7fc;
border: 1px solid #4d90fe;
border-radius: 3px 3px 3px 3px;
}
.boxes2{
text-align: left;
font-size: 18px;
width: 1150px;
height: 300px;
color: #4d90fe;
font-weight: bold;
margin-left: 100px;
background: #f3f7fc;
border: 1px solid #4d90fe;
border-radius: 3px 3px 3px 3px;
}
.run_btn {
border-radius: 3px 3px 3px 3px;
background: #4d90fe;
border: 1px solid #4d90fe;
display: inline-block;
vertical-align: middle;
color: #f3f7fc;
font-weight: bold;
width: 100px;
font-size: 18px;
height: 41px;
cursor: hand;
}
.run_btn:hover{background:#1874CD} .delete_btn{
border-radius: 3px 3px 3px 3px;
background: #F0CB85;
border: 1px solid #F0CB85;
cursor: pointer;
display: inline-block;
vertical-align: middle;
color: #DC143C;
font-weight: bold;
width: 100px;
font-size: 18px;
height: 41px;
}
.delete_btn:hover{background:#DEB887} .cen{
text-align: center;
} *{
margin: 0;
padding: 0;
} li{
background: #EEE;
line-height: 24px;
display: block;
position: relative;
color:red;
} li a{
line-height: 24px;
display: block;
color: red;
margin-left: 20px;
text-align: center;
} li a:hover{
color: red;
} ul li input[type="checkbox"]{
position: absolute;
top: 0;
width: 100%;
height: 24px;
opacity: 0;
cursor: hand;
} ul li input[type="checkbox"]:not(:checked) + ul {
display: none;
cursor: hand;
} #text{
font-size:20px;
margin-left:200px;
color:red;
cursor: hand;
} </style>
</head>
<body background="http://images2015.cnblogs.com/blog/512541/201511/512541-20151124231305937-1592292858.jpg" bgproperties="fixed" style="background: #f3f7fc;"
>
<p style="text-align: center;color: blue;font-weight: bold;">test.html</p>
<textarea class="boxes" name="textarea" cols="100" rows="26" id="rn01">
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>浏览器HTML运行</title>
</head>
<body> <h1>请输入你想要输入的内容</h1>
<p>内容最好不要为空,否则没有显示效果</p> </body>
</html>
</textarea>
<hr />
<form class="cen">
<input class="run_btn" onClick="runEx('rn01')" type="button" value="运行代码">
<input class="delete_btn" onClick="quickdelete('rn01')" type="button" value="清空代码">
</form>
<ul>
<li><a>不想写开头,参考一下HTML开头吧!</a>
<input type="checkbox" name="list" />
<ul>
<li>
<textarea class="boxes2">
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body> <h1>请输入你想要输入的内容</h1>
<p>内容最好不要为空,否则没有显示效果</p> </body>
</html>
</textarea>
</li>
<li><a href="http://www.cnblogs.com/tufujie" target="_blank" title="点击进入追梦人...博客首页">如有疑问,可直接访问:追梦人...博客首页</a></li>
</ul>
</li>
</ul>
</body>
</html>

浏览器编辑HTML的更多相关文章

  1. 浏览器编辑web页面的方法

    F12打开控制台执行 document.body.contentEditable='true'; 这样就可以随便修改了

  2. 在线office文档编辑NTKO使用心得

    目录 前言 什么是ntko 准备工作 实战演练 总结 一.前言 Web开发中经常需要用到在线处理office文档的功能,现在市面上有一些常用的Web页面调用显示Office的控件技术,用起来很方便.有 ...

  3. 关于Anaconda安装以后使用Jupyter Notebook无法直接打开浏览器的解决方法

    关于Anaconda安装以后使用Jupyter Notebook无法直接打开浏览器的解决方法 1.首先打开Anoconda Prompt,输入命令 jupyter notebook --generat ...

  4. 使用Word发表博客

        使用浏览器编辑博客,会让你感到非常不方便,如果在没有网络的时候,就不能打开编辑器页面了,只能先写在word或其他编辑软件中.可以设置word使用word编辑并直接发布到博客.   文件 - 新 ...

  5. JAVA上百实例源码以及开源项目

    简介 笔者当初为了学习JAVA,收集了很多经典源码,源码难易程度分为初级.中级.高级等,详情看源码列表,需要的可以直接下载! 这些源码反映了那时那景笔者对未来的盲目,对代码的热情.执着,对IT的憧憬. ...

  6. editplus快捷键大全其他editplus快捷键

    editplus快捷键大全其他editplus快捷键,更多快捷键请参考以下文章:editplus快捷键大全之editplus搜索快捷键 editplus快捷键大全之editplus编辑快捷键 edit ...

  7. editplus快捷键大全

    Eclipse快捷键 10个最有用的快捷键 1. ctrl+shift+r:打开资源 ctrl+b编译 ctrl+d删除 2. ctrl+o:快速outline  --->这个是查看一个类中的用 ...

  8. linux samba.tar.gz安装和配置

    安装步骤: 1. tar -xzvf samba-3.5.10.tar.gz2. cd samba-3.5.103. cd source34. ./autogen.sh  如果出现:./autogen ...

  9. 初步接触html心得

    接触HTML大概有七天,做一下小总结,过过记忆. html大致可分为三部分:Dtd头.Head.Body三大部分. Dtd头:是用于浏览器编辑的,也就是俗话说的给电脑看的的东西. Head:内细分下大 ...

随机推荐

  1. mac 查看系统时区

    sudo systemsetup -gettimezone https://developer.apple.com/library/mac/documentation/Darwin/Reference ...

  2. makefile-0711-168 SEVERE ERROR: Input file:

    ld: 0711-168 SEVERE ERROR: Input file: /cicm/commlib/include        Input files must be regular file ...

  3. centos svn安装

    http://fengjunoo.iteye.com/blog/1759265(参考) 以前在ubuntu上安装过一次svn,那次弄得有些麻烦. 这次记录下centos环境下安装svn的步骤 其实简单 ...

  4. Linux负载均衡概念与实践(二)

    构建实践LVS+Keepalived实现负载均衡 keepalived概述 1.keepalived是专门针对LVS设计的一款强大的辅助工具,主要用来提供故障切换和健康检查功能——判断LVS负载调度器 ...

  5. Blu-Ray BRRip 和 BDRip 的区别

    Blu-Ray BRRip & BDRip 的区别 最近看电影有点多,常常看到blueray或者BDRip的格式,所以找了一下这两种格式的区别. BRRip = 来自蓝光盘片的xvid编码 B ...

  6. C# partial 说明

    1. 什么是局部类型? C# 2.0 引入了局部类型的概念.局部类型允许我们将一个类.结构或接口分成几个部分,分别实现在几个不同的.cs文件中. 局部类型适用于以下情况: (1) 类型特别大,不宜放在 ...

  7. [Linux]查看本机IP

    命令: ~$ ip addr showor~$ ipconfig 

  8. ExtJS4加载FormPanel数据的几种方式

    我们做web应用最多的就是处理表单,extjs为我们提供了很多处理表单的功能,很多初学者疑惑怎么加载表单数据,到底能用什么方式加载?本文中,我将我自己实验过的进行一下总结,自己备忘,也希望能帮助到其他 ...

  9. 微信web开发者工具调试

    微信web开发者工具调试 前几天写了一篇使用fiddler调试微信端页面的,然后博友评论说使用fiddler太麻烦了,推荐使用微信web开发者工具调试微信页面,这两天弄着玩了一下,很强大.这篇文章只是 ...

  10. SWFUpload下载地址

    SWFUpload托管在谷歌代码上面,点击下载: https://code.google.com/p/swfupload/