在线实时编译运行html

这篇博客介绍了如何在线实时编译并运行HTML,包括使用Blob对象和URL.createObjectURL创建URL,利用document.initMouseEvent初始化鼠标事件,以及设置HTML禁用右键和选择的功能。此外,还探讨了window.open方法用于打开新窗口或已有窗口的特性,并提供了详细参数说明。
摘要由CSDN通过智能技术生成

效果:

在这里插入图片描述

代码:

可跳过代码直达问题汇总

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>在线HTML</title>
	</head>
	<body>
		<style>
			html{
    
				height: 100%; padding: 0; margin: 0;
			}
			body{
    
				height: 100%;
				padding: 0;
				margin: 0;
				/* h5页面禁止复制以及禁止右键 */
				-webkit-touch-callout:none;  /*系统默认菜单被禁用*/
				-webkit-user-select:none; /*webkit浏览器*/
				-khtml-user-select:none; /*早期浏览器*/
				-moz-user-select:none; /*火狐*/
				-ms-user-select:none;  /*IE10*/
				user-select:none;
			}
			.content{
    
				display: flex;
				flex-direction: column;
				height: calc(100% - 45px);
				padding: 0;
				margin: 0;
			}
			textarea{
    
				padding: 10px;
				resize: none;
				width: calc( 100% - 20px ); 
				margin: 0;
				border: 0;
			}
			textarea:focus{
    
				/* 文本域 获取焦点后的样式 */
				/* outline: none; */
			}
			iframe{
    
				margin: 0; border: 0;
				height: 50%; border-top: 1px solid red;
			}
			.content #edit{
    
				height: 50%; display: flex;
    			flex-direction: initial;
			}
			.content #editHtml{
    
				border-right: 1px solid red;
			}
			.controls{
    
				border-top   : 1px solid #808080;
				border-bottom: 1px solid #808080;
				
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值