浏览器编辑HTML
运行效果:
浏览器编辑HTML
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- 不想写开头,点击此处参考一下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的更多相关文章
- 浏览器编辑web页面的方法
F12打开控制台执行 document.body.contentEditable='true'; 这样就可以随便修改了
- 在线office文档编辑NTKO使用心得
目录 前言 什么是ntko 准备工作 实战演练 总结 一.前言 Web开发中经常需要用到在线处理office文档的功能,现在市面上有一些常用的Web页面调用显示Office的控件技术,用起来很方便.有 ...
- 关于Anaconda安装以后使用Jupyter Notebook无法直接打开浏览器的解决方法
关于Anaconda安装以后使用Jupyter Notebook无法直接打开浏览器的解决方法 1.首先打开Anoconda Prompt,输入命令 jupyter notebook --generat ...
- 使用Word发表博客
使用浏览器编辑博客,会让你感到非常不方便,如果在没有网络的时候,就不能打开编辑器页面了,只能先写在word或其他编辑软件中.可以设置word使用word编辑并直接发布到博客. 文件 - 新 ...
- JAVA上百实例源码以及开源项目
简介 笔者当初为了学习JAVA,收集了很多经典源码,源码难易程度分为初级.中级.高级等,详情看源码列表,需要的可以直接下载! 这些源码反映了那时那景笔者对未来的盲目,对代码的热情.执着,对IT的憧憬. ...
- editplus快捷键大全其他editplus快捷键
editplus快捷键大全其他editplus快捷键,更多快捷键请参考以下文章:editplus快捷键大全之editplus搜索快捷键 editplus快捷键大全之editplus编辑快捷键 edit ...
- editplus快捷键大全
Eclipse快捷键 10个最有用的快捷键 1. ctrl+shift+r:打开资源 ctrl+b编译 ctrl+d删除 2. ctrl+o:快速outline --->这个是查看一个类中的用 ...
- linux samba.tar.gz安装和配置
安装步骤: 1. tar -xzvf samba-3.5.10.tar.gz2. cd samba-3.5.103. cd source34. ./autogen.sh 如果出现:./autogen ...
- 初步接触html心得
接触HTML大概有七天,做一下小总结,过过记忆. html大致可分为三部分:Dtd头.Head.Body三大部分. Dtd头:是用于浏览器编辑的,也就是俗话说的给电脑看的的东西. Head:内细分下大 ...
随机推荐
- javascript异步执行函数导致的变量变化问题解决思路
for(var i=0;i<3;i++) { setTimeout(function(){ console.log(i) },0); }控制台输出:333 这是因为执行方法的时候for循环已经执 ...
- java之多态的使用
首先,什么是多态?我们应该从什么角度来理解多态?其实,我们不妨把多态理解成一种事物的多种存在形态,比如,猫和狗都可以变成动物,而动物又可以变成猫和狗. 为了充分理解多态,我们可以从以下这几个方面来理解 ...
- C语言遍历一个文件夹下面的所有文件
主要用到的函数/function. These should get you started: opendir() readdir() closedir() fopen() fread() fwrit ...
- Headfirst设计模式的C++实现——适配器(Adapter)
duck.h #ifndef _DUCK_H_ #define _DUCK_H_ class DUCK { public: ; ; }; #endif mallard_duck.h #ifndef _ ...
- Eclipse启动报错Java was started but returned exit code=13
启动Eclipse的时候报错Java was started but returned exit code=13,这个错误的原因是由于eclipse版本与jdk版本不符导致的,可能你的eclipse是 ...
- 尚学堂JavaEE项目备选
偶然得知:记下待练 微博 软件人才网 论坛 博客系统 京东网上商城 赶集网 拉手网 优酷视频 百度知道(问答) 生产管理系统 房屋租赁网 金融股票
- js实现浏览器兼容复制功能
经常看到这样一种效果:就是单击一个按钮,就将某个区域内的内容,复制到了剪切板中.其实这个功能实现起来也不难,核心就是用到了window子对象clipboardData的一个方法:setData()语法 ...
- AOP(以MVC中的过滤器为例)
MVC里面的Filter public class AOPFilterAttribute : ActionFilterAttribute, IExceptionFilter { public void ...
- 刷漆(Codechef October Challenge 2014:Remy paints the fence)
[问题描述] Czy做完了所有的回答出了所有的询问,结果是,他因为脑力消耗过大而变得更虚了:).帮助Czy恢复身材的艰巨任务落到了你的肩上. 正巧,你的花园里有一个由N块排成一条直线的木板组成的栅栏, ...
- Bootstrap 分页功能
function bootstrappage() { var options = { currentPage: currentPage, totalPages: totalPages, size: ' ...