導航:首頁 > 編程大全 > javascript腳本調試工具

javascript腳本調試工具

發布時間:2024-07-04 00:49:19

⑴ 如何進行html調試和js腳本調試

1、在chrome中打開開發者工具,打開方式如下圖,也可以使用快捷鍵F12來打開。內

⑵ Firefox3火狐瀏覽器javascript腳本調試插件怎麼用

你說的是firebug嗎 去amo上下載安裝 要用的時候點工具欄的按鈕呼出或者F12呼出即可

具體使用如果你看一下應該慢慢就會了 不是一句話能說清楚的

⑶ 如何進行html調試和js腳本調試

工具來/原料

chrome瀏覽器 Mozilla firefox 電腦

方法/步驟自

1、以chrome為例,首先打開需要調試的頁面,按F12快捷鍵打開調試工具。

⑷ 有能調試javascript腳本的工具嗎

現在「富客戶端」是炒得比較火的一個概念。所謂的富客戶端一般需要寫大量的javascript/vbscript代碼,腳本語言是比較難調試的,雖然可以使用OFFICE中帶的腳本調試程序、DOTNET或其它的專業工具來調試,可總是些不方便。
寫過VC程序的人相信比較熟悉TRACE、afxDump等幾個函數,這幾個函數可以在工具窗口實時的輸出一些調試信息,可以很方便的發現一些運行時錯誤。有人使用純腳本的方式實現了類似的跟蹤調試功能,經過使用發現確實可以給開發帶來比較大的方便。代碼是以CodeProject網站上找到的,原理很簡單,使用很方便。調試信息分為Message、Warn及Exception幾種,以不同的顏色顯示,很直觀。
下面把相應代碼及使用幫助貼出來,感興趣的網友可以拷貝粘貼後使用。
主要是兩個文件
/***************************************************************************/
一、腳本文件(文件名:debuggingTools.js)
/***************************************************************************/
//debug helper class to control popup windows
var DebugHelper = function()
{
this.Active = true;
this.ShowException = true;
this.ShowURL = true;
this.ShowLastModified = false;
this.ShowReferrer = false;
this.VerboseMode = false;
//reference to the popup window
this.DebugWindow = null;
this.CssStyleFile = new String("debugWindow.css");
this.WindowStyle = new String("left=0,top=0,width=300,height=300,scrollbars=yes,status=no,resizable=yes");
//no spaces to run correctly on internet explorer
this.WindowName = new String("JavascriptDebugWindow");
this.WindowTitle = new String("Javascript Debug Window");
}

//method to show the debug window
DebugHelper.prototype.ShowWindow = function()
{
try
{
if( this.Active )
{
this.DebugWindow = window.open("", this.WindowName, this.WindowStyle);
this.DebugWindow.opener = window;
//open the document for writing
this.DebugWindow.document.open();
this.DebugWindow.document.write(
"<html><head><title>" + this.WindowTitle + "</title>" +
"<link rel='stylesheet' type='text/css' href='" + this.CssStyleFile + "' />" +
"</head><body><div id='renderSurface' style='width: 100%; height: 100%;' /></body></html>\n"
);
this.DebugWindow.document.close();
}
}
catch(ex)
{
//ignore exception
}
}

//if the debug window exists, then write to it
DebugHelper.prototype.$Write = function(cssClass, message, url, lastModified, referrer)
{
try
{
if( this.Active )
{
if( this.DebugWindow && ! this.DebugWindow.closed )
{
var msg = message;

if( this.ShowURL && url != null )
msg += " at " + url;

if( this.ShowLastModified && lastModified != null )
msg += " last modified in " + lastModified;

if( this.ShowReferrer && referrer != null )
msg += " referrer " + referrer;

this.DebugWindow.document.getElementById("renderSurface").innerHTML = "<span class='" + cssClass + "'>" + msg + "</span>" + this.DebugWindow.document.getElementById("renderSurface").innerHTML;
}
}
}
catch(ex)
{
//ignore exception
}
}

//write a message to debug window
DebugHelper.prototype.Message = function(message, url, lastModified, referrer)
{
try
{
this.$Write("debugMessage", message, url, lastModified, referrer);
}
catch(ex)
{
//ignore exception
}
}

//same as debug, plus another style applyied
DebugHelper.prototype.Warn = function(message, url, lastModified, referrer)
{
try
{
this.$Write("debugWarn", message, url, lastModified, referrer);
}
catch(ex)
{
//ignore exception
}
}

//same as debug, plus a strong style applyied
DebugHelper.prototype.Exception = function(message, url, lastModified, referrer)
{
try
{
if( this.ShowException )
{
this.$Write("debugException", message, url, lastModified, referrer);
}
}
catch(ex)
{
//ignore exception
}
}

//if the debug window exists, then close it
DebugHelper.prototype.HideWindow = function()
{
try
{
if( this.DebugWindow && !this.DebugWindow.closed )
{
this.DebugWindow.close();
this.DebugWindow = null;
}
}
catch(ex)
{
//ignore exception
}
}

//create a global debug object
var debugHelper = new DebugHelper();
//you should show the window right here to get loading errors or sintax errors of other pages
//debugHelper.ShowWindow();

//catch generic errors also
function WindowOnError(msg, url, line)
{
if( debugHelper )
{
debugHelper.Exception(msg, line + " at " + url);
}
}
window.onerror = WindowOnError;
/***************************************************************************/
二、樣式表(文件名:debugWindow.css)
/***************************************************************************/
body
{
background-color: #ffffff;
font-family: "Courier New", Courier, monospace;
}
span.debugMessage
{
border-bottom:1px dotted #cccccc;
color: #000000;
display: block;
margin: 1px;
}
span.debugWarn
{
border-bottom:1px dotted #aaaa00;
color: #0000aa;
display: block;
}
span.debugException
{
border-bottom:1px dotted #ff0000;
color: #aa0000;
display: block;
font-weight: bold;
}
/***************************************************************************/
三、使用示例
/***************************************************************************/
使用很簡單了,在網頁上包含上面的腳本文件,使用下面幾個函數就可以了。
debugHelper.ShowWindow();//顯示調試窗口
debugHelper.HideWindow();//隱藏調試窗口
debugHelper.Message("信息");//顯示message級別信息
debugHelper.Warn("信息");//顯示warn級別信息。
debugHelper.Exception("信息");//顯示Exception級別信息。

閱讀全文

與javascript腳本調試工具相關的資料

熱點內容
手機代碼轉移 瀏覽:832
安卓手機可以下載蘋果輸入法嗎 瀏覽:369
升級寬頻後路由器速度還是很慢 瀏覽:882
jsp添加英文日期控制項 瀏覽:329
自己寫的編程怎麼交流 瀏覽:677
淘寶app怎麼退貨 瀏覽:323
win10攝像頭驅動中文版 瀏覽:757
pc版網路機頂盒系統 瀏覽:407
星際跑酷安卓 瀏覽:157
分布式大數據平台 瀏覽:368
win10無法連接到win7列印機 瀏覽:814
用友實施與維護工具 瀏覽:913
labview如何把數據保存到文本 瀏覽:399
圖片文件怎麼排序 瀏覽:514
蘋果app哪裡可以下載 瀏覽:57
代碼超鏈接 瀏覽:695
如何給整個文件夾加密 瀏覽:804
db格式資料庫 瀏覽:321
錯誤代碼3201a000000 瀏覽:851
水印教程 瀏覽:127

友情鏈接