这是哪里有问题,为什么总是报错?
时间:2010-05-07
来源:互联网
复制内容到剪贴板
<input type="button" value="运行代码" onclick="runCode(runcode0)" />
<input type="button" value="复制代码" onclick="copycode(runcode0)" />
<input type="button" value="另存代码" onclick="saveCode(runcode0)" /> 提示:您可以先修改部分代码再运行
<script language="javascript">
script>
function runCode(obj){ //定义一个运行代码的函数,
var code=getByid("runcode"+obj).value;//即要运行的代码。
var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。
newwin.opener = null // 防止代码对论谈页面修改
newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
newwin.document.close();
}
//复制代码
function doCopy(obj) {
if (document.all){
textRange = getByid("runcode"+obj).createTextRange();
textRange.execCommand("Copy");
alert("代码已经复制到剪切板");
}else{
alert("此功能只能在IE上有效nn请在文本域中用Ctrl+A选择再复制")
}
}
//另存代码
function saveCode(obj) {
var winname = window.open('','','width=0,height=0,top=200,left=200px');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.execCommand('saveas','','CSS打造经典鼠标触发显示选项.html');
winname.close();
}
</script>
代码:
<textarea cols="95" rows="15" name="runcode0" >运行的代码</textarea><input type="button" value="运行代码" onclick="runCode(runcode0)" />
<input type="button" value="复制代码" onclick="copycode(runcode0)" />
<input type="button" value="另存代码" onclick="saveCode(runcode0)" /> 提示:您可以先修改部分代码再运行
<script language="javascript">
script>
function runCode(obj){ //定义一个运行代码的函数,
var code=getByid("runcode"+obj).value;//即要运行的代码。
var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。
newwin.opener = null // 防止代码对论谈页面修改
newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
newwin.document.close();
}
//复制代码
function doCopy(obj) {
if (document.all){
textRange = getByid("runcode"+obj).createTextRange();
textRange.execCommand("Copy");
alert("代码已经复制到剪切板");
}else{
alert("此功能只能在IE上有效nn请在文本域中用Ctrl+A选择再复制")
}
}
//另存代码
function saveCode(obj) {
var winname = window.open('','','width=0,height=0,top=200,left=200px');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.execCommand('saveas','','CSS打造经典鼠标触发显示选项.html');
winname.close();
}
</script>
作者: Anthonys 发布时间: 2010-05-07
<!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 cols="95" rows="15" name="runcode0" id="runcode0" >运行的代码</textarea> <input type="button" value="运行代码" onclick="runCode(0)" /> <input type="button" value="复制代码" onclick="doCopy(0)" /> <input type="button" value="另存代码" onclick="saveCode(0)" /> 提示:您可以先修改部分代码再运行 <script language="javascript"> function runCode(obj){ //定义一个运行代码的函数, var code=document.getElementById("runcode"+obj).value;//即要运行的代码。 var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。 newwin.opener = null // 防止代码对论谈页面修改 newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。 newwin.document.close(); } //复制代码 function doCopy(obj) { if (document.all){ textRange = document.getElementById("runcode"+obj).createTextRange(); textRange.execCommand("Copy"); alert("代码已经复制到剪切板"); }else{ alert("此功能只能在IE上有效nn请在文本域中用Ctrl+A选择再复制") } } //另存代码 function saveCode(obj) { var winname = window.open('','','width=0,height=0,top=200,left=200px'); winname.document.open('text/html', 'replace'); winname.document.write(obj.value); winname.document.execCommand('saveas','','CSS打造经典鼠标触发显示选项.html'); winname.close(); } </script> </body> </html>
提示:您可以先修改部分代码再运行
提示:您可以先修改部分代码再运行
作者: qxq864298 发布时间: 2010-05-07
哦,耶! 可以了,谢谢,是没看仔细
作者: Anthonys 发布时间: 2010-05-07
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28