<form id="form1" runat="server">
<input id="ClkBtn" type="button" value="addClickOnBtn" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script language="javascript" type="text/javascript">

$addHandlers ($get ("ClkBtn"), {
    mouseover: onMouseOver,
    mouseout: onMouseOut
});

function onMouseOver (e) { this.style.backgroundColor = 'yellow'; }
function onMouseOut (e) { this.style.backgroundColor = 'white'; }


var article = Sys.UI.DomElement.getElementById('ClkBtn');
alert(article.value);


var article = $get('ClkBtn');
alert(article.value);

var article = $get('ClkBtn');
var position = Sys.UI.DomElement.getLocation(article);
var x = position.x, y = position.y;
alert(x);
alert(y);


var menu = $get('ClkBtn');
Sys.UI.DomElement.setLocation(menu, 500, 500);


var article = $get('ClkBtn');
var bounds = Sys.UI.DomElement.getBounds(article);
Sys.Debug.traceDump (bounds, 'Article position and size');


var a = ['a','b','c','d'];
var b = Array.clone(a);
alert(b);


var a = ['red','green','blue','yellow'];
var b = Array.contains(a, "red");
alert(b);

var myArray = [],result = "";
Array.add(myArray, 'a');
Array.add(myArray, 'b');
Array.add(myArray, 'c');
Array.add(myArray, 'd');
result = Array.dequeue(myArray);
alert(myArray);
alert(result);

 

var a = ['a', 'b', 'c', 'd'];
a[5] = 'e';
var result = '';
function appendToString(arrayElement, index, array) {
    result += arrayElement + this + index + ',';
}
Array.forEach(a, appendToString, '|');
alert(result);

 

var a = ['red', 'blue', 'green', 'blue'];
var myFirstIndex = Array.indexOf(a, "blue");
var mySecondIndex = Array.indexOf (a, "blue", (myFirstIndex + 1));
// myFirstIndex = 1, mySecondIndex = 3

alert(myFirstIndex);
alert(mySecondIndex);


var a = ['a', 'b', 'd', 'e'];
Array.insert(a, 2, 'c');
alert(a);

var a = Array.parse ("['red', 'blue', 'green']");
alert(a[0]);
alert(a[1]);
alert(a[2]);

 

var a = ['a', 'b', 'c', 'd', 'e'];
Array.remove(a, 'c');
alert(a);
Array.removeAt(a, 2);
alert(a);

</script>
 </form>

posted on 2007-08-11 14:28  萧佰刚  阅读(177)  评论(0编辑  收藏  举报