转载自:http://www.cnblogs.com/rayking/archive/2008/09/03/1282466.html

FireBug 是一个非常实用的JavaScript以及DOM查看调试工具,是 Firefox 的一个插件。使用 FireBug 调试 AJAX 应用非常方便,终于可以告别 alert 时代了!

Console Logging 函数FireBug 为所有 Web 页面提供了一个 console 对象。这个对象有以下函数:

Logging 基础
console.log("message" [,objects]) - 将一个字符串打印到控制台。字符串可以包含任何“String Formatting”小节描述的模式。字符串后面的对象应该用来取代之前字符串中的模式。(译者注:大家用过C里面 printf 吧,效果基本是一样的。)
Logging 等级通常根据不同的等级来区分Logging的严重程度是很有帮助的。FireBug 提供了4个等级。为了达到视觉分离的效果,这些函数与 log 不同的地方就是它们在被调用的时候会自动包含一个指向代码行数的链接。
console.debug("message" [,objects]) - 记录一个 debug 消息。
console.info("message" [,objects]) - 记录一个信息.
console.warn("message" [,objects]) - 记录一个警告.
console.error("message" [,objects]) - 记录一个错误.

断言断言是一条确保代码规则的非常好的途径。console 对象包含了一系列各种类型的断言函数,并且允许你编写自己的断言函数。
console.assert(a, "message" [,objects]) - Asserts that an a is true.
console.assertEquals(a, b, "message" [,objects]) - Asserts that a is equal to b.
console.assertNotEquals(a, b, "message" [,objects]) - Asserts that a is not equal to b.
console.assertGreater(a, b, "message" [,objects]) - Asserts that a is greater than b.
console.assertNotGreater(a, b, "message" [,objects]) - Asserts that a is not greater than b.
console.assertLess(a, b, "message" [,objects]) - Asserts that a is less than b.
console.assertNotLess(a, b, "message" [,objects]) - Asserts that a is not less than b.
console.assertContains(a, b, "message" [,objects]) - Asserts that a is in the array b.
console.assertNotContains(a, b, "message" [,objects]) - Asserts that a is not in the array b.
console.assertTrue(a, "message" [,objects]) - Asserts that a is equal to true.
console.assertFalse(a, "message" [,objects]) - Asserts that a is equal to false.
console.assertNull(a, "message" [,objects]) - Asserts that a is equal to null.
console.assertNotNull(a, "message" [,objects]) - Asserts that a is not equal to null.
console.assertUndefined(a, "message" [,objects]) - Asserts that a is equal to undefined.
console.assertNotUndefined(a, "message" [,objects]) - Asserts that a is not equal to undefined.
console.assertInstanceOf(a, b, "message" [,objects]) - Asserts that a is an instance of type b.
console.assertNotInstanceOf(a, b, "message" [,objects]) - Asserts that a is not an instance of type b.
console.assertTypeOf(a, b, "message" [,objects]) - Asserts that the type of a is equal to the string b.
console.assertNotTypeOf(a, b, "message" [,objects]) - Asserts that the type of a is not equal to the string b.

测量(Measurement)下面的一些函数可以让你方便的测量你的一些代码。
console.trace() - 记录执行点的堆栈信息。
console.time("name") - 根据 name 创建一个唯一的计时器。
console.timeEnd("name") - 根据 name 停止计时器,并且记录消耗的时间,以毫秒为单位。
console.count("name") - 记录该行代码执行的次数。

字符串格式化所有 console 的 logging 函数都可以通过以下模式格式化字符串:
%s - 将对象格式化为字符串。
%d, %i, %l, %f - 将对象格式化为数字。
%o - 将对象格式化成一个指向 inspector 的超链接。
%1.o, %2.0, etc.. - 将对象格式化成包含自己属性的可交互的表格。
%.o - 将对象格式化成具有自身属性的一个数组。
%x - 将对象格式化成一个可交互的 XML 树形结构。
%1.x, %2.x, etc.. - 将对象格式化成一个可交互的 XML 数型结构,并且展开 n 层节点。
如果你需要一个真实的 % 符号,你可以通过一个转移符号就像这样 "\%"。
命令行函数内建的命令行函数可以通过以下命令行使用:
$("id") - document.getElementById() 的简写。(译者注:跟 prototype.js 学来的吧?)
$$("css") - 返回一个符合 CSS 选择器的元素数组。
$x("xpath") - 返回一个符合 XPath 选择器的元素数组。
$0 - 返回最近被检查(inspected)的对象。
$1 - 返回最近被检查(inspected)的下一个对象。
$n(5) - 返回最近被检查的第n个对象。
inspect(object) - 将对象显示在 Inspector 中。
dir(object) - 返回一个对象的属性名数组。(译者注:跟 Python 学的?)
clear() - 清除控制台信息。

posted @ 2008-10-06 15:51 flykye 阅读(5) | 评论 (0)编辑

//显示属性
display
list-style
position
float
clear

//自身属性
width
height
margin
padding
border
background

//文本属性
color
font
text-decoration
text-align
vertical-align
white-space
other text
content

posted @ 2008-10-06 14:54 flykye 阅读(7) | 评论 (0)编辑

IE6,IE7,FF3测试通过

 

CSS
* {
margin
:0;
padding
:0;
list-style
:none;
}

#vertical_box
{
width
:100%;
display
:table;
border
:1px red solid;
height
:400px;
 /*针对IE的hack*/
*position
:relative;
}

#vertical_box_sub
{
display
: table-cell;
vertical-align
: middle;
 /*针对IE的hack*/
*position
:absolute;
*top
:50%;
}

#vertical_box_container
{
font-family
:"宋体";
border
:1px green solid;
/*针对IE的hack*/
*position
:relative;
*top
:-50%;

margin
:0 auto;
width
:200px;
}

 

 

HTML
<div id="vertical_box">
<div id="vertical_box_sub">
<div id="vertical_box_container">
<p>我是居中的文字</p>
<p>我居中</p>
<p>你也居中</p>
<img src="http://www.adobetutorialz.com/Advertising/W3Markup.jpg" border=0 alt="" title="">
</div>
</div>
</div>
posted @ 2008-10-05 21:10 flykye 阅读(16) | 评论 (0)编辑

需要引入

import flash.external.ExternalInterface;

一、ActionScript调用JavaScript的方法

     这里要用到ExternalInterface类的call方法

     ExternalInterface.call(functionName:String,...arguments):*

     fuctionName:要调用的JavaScript函数名

     arguments:参数,可选

     1.不带参数的情况

JavaScript
function Show() {
alert(
"I am a func!");
}

 

ActionScript

 

      2.带参数的情况

JavaScript

 

ActionScript

 

     另外,也可以用getURL方法来调用

     getURL("javascript:show('i am a message from as)","_self");

二、JavaScript调用ActionScript的方法

     这要用到ExternalInterface类的addCallback方法

     ExternalInterface.addCallback( functionName:String, closure:Function):void  

     functionName:要注册的函数名

     closure:对应的执行函数

ActionScript
ExternalInterface.addCallback("Show",OnShow);

private
function OnShow(message:String):string{

return message;

}

 

 

JavaScript
function thisMovie(movieName){
if(navigator.appName.indexOf("Microsoft") != -1){
return window[movieName];
}
else{
return document[movieName];
}
}


function CallAS( ) {
thisMovie(
"ViewLesson").Show("i am a message from js");//ViewLesson是flash媒体的ID

}

 

HTML
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id
="ViewLesson" width="100%" height="100%"
codebase
="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="ViewLesson.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="ViewLesson.swf" quality="high" bgcolor="#869ca7"
width
="100%" height="100%" name="ViewLesson" align="middle"
play
="true"
loop
="false"
quality
="high"
allowScriptAccess
="sameDomain"
type
="application/x-shockwave-flash"
pluginspage
="http://www.adobe.com/go/getflashplayer">
</embed>
</object>

posted @ 2008-10-05 19:43 flykye 阅读(14) | 评论 (0)编辑
function Dog()
{
this.name = "普通的狗";
this.wow = function()
{
alert(
this.name + " is wowing!!");
}
this.sleep = function()
{
alert(
this.name + " is sleep");
}
}

function FlyingDog()
{
this.name = "会飞的狗";
this.wow = function()
{
alert(
this.name + " is flying and wowing");
}
}
FlyingDog.prototype
= new Dog();
flyingdog
= new FlyingDog();
flyingdog.wow();
flyingdog.sleep();
posted @ 2008-10-05 02:21 flykye 阅读(14) | 评论 (0)编辑

很少见的用法……

var elem1 = [1,2,3,5,6];
var elem2 = [7,5,0];

label1 : {
    for (var i = 0; i < 10; i++) {
        for (var j = 0; j < 10; j++) {
            if (elem1[i] == elem2[j]) {
                break label1;
            }
        }
    }
}

posted @ 2008-10-04 22:40 flykye 阅读(12) | 评论 (0)编辑

嘿嘿,你的Blog通过质检了么??

posted @ 2008-10-04 20:28 flykye 阅读(19) | 评论 (1)编辑

崩溃的现象越来越严重

网速一慢,假死的现象很明显

没以前好了,唯一好的就是它的拖拽功能

posted @ 2008-10-04 13:44 flykye 阅读(15) | 评论 (0)编辑

描述:IE下,当LI里面的内容有float属性时候,LI方会出现3px的空白

例如:

 

CSS
* {margin:0; padding:0; list-style:none; }
ul {
width:200px;
}
li {
width:200px;
background
-color:red;
}
.tex {
float:left;
}

<ul>
<li><div class="tex">我是LI</div></li>
<li><div class="tex">我是LI</div></li>
<li><div class="tex">我是LI</div></li>
<li><div class="tex">我是LI</div></li>
</ul>

 

IE显示下的效果

解决办法:

给li加上float,然后再加上clear

 

CSS
li {
float
:left;
clear
:left;
width
:200px;
background-color
:red;
}

 

 

posted @ 2008-10-04 10:58 flykye 阅读(8) | 评论 (0)编辑
<div style="width: 200px;border: 1px solid red;overflow: hidden;text-overflow:ellipsis">
<nobr>大家好,我是文字,我很长很长很很长很长很很长很长很长.</nobr>
</div>

效果如下所示:

大家好,我是文字,我很很长...

 

可是FF不支持。等找到解决办法再来。

posted @ 2008-10-03 23:59 flykye 阅读(11) | 评论 (0)编辑