如何在线编辑js源码调试

JavaScript010

如何在线编辑js源码调试,第1张

使用火狐浏览器。安装firebug。

安装后,按F12,打开firebug

找到脚本,启用脚本。

找到要调试的JS文件

在需要断点的地方,鼠标点下左侧

会出现一个红点

执行到这里的时候,就会进行调试了

下载一个webshell放到你的服务器上,设置好该JS文件的权限为everyone可写

然后就可以通过webshell修改了

大哥 问完问题就不来了 我这回答可怎么办啊?谁给我采纳最佳答案啊?

东拼西凑的,而且只在ie下有效,不过网上有兼容ff的代码,以下是html代码

<!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/htmlcharset=gb2312" />

<title>无标题文档</title>

</head>

<body>

<input type="button" value="投票" onclick="javascript:addvote()" /><br />

文本:<span id="t"></span>

<script>

loadXML = function(xmlFile){

var xmlDoc

if(window.ActiveXObject){

xmlDoc = new ActiveXObject('Microsoft.XMLDOM')

xmlDoc.async = false

xmlDoc.load(xmlFile)

}

else if (document.implementation&&document.implementation.createDocument){

xmlDoc = document.implementation.createDocument('','',null)

xmlDoc.load(xmlFile)

}

else{

return null

}

return xmlDoc

}

checkXMLDocObj = function(xmlFile){

var xmlDoc = loadXML(xmlFile)

if(xmlDoc==null){

alert('您的浏览器不支持xml文件读取,于是本页面禁止您的操作,推荐使用IE5.0以上可以解决此问题!')

window.location.href='/Index.aspx'

}

return xmlDoc

}

function addvote(){

var xmlDoc = checkXMLDocObj("vote.xml")

var text = xmlDoc.getElementsByTagName("time")[0].childNodes[0]

text.nodeValue++

document.getElementById("t").innerHTML=text.nodeValue

var fso, tf

fso = new ActiveXObject("scripting.FileSystemObject")

// 创建新文件

tf = fso.CreateTextFile("vote.xml", true)

// 填写数据,并增加换行符

tf.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\"?>")

tf.WriteLine("<vote>")

tf.WriteLine("<time>"+text.nodeValue+"</time>")

tf.WriteLine("</vote>")

// 关闭文件

tf.Close()

}

</script>

</body>

</html>

以下是vote.xml

<?xml version="1.0" encoding="gb2312"?>

<vote>

<time>0</time>

</vote>