js学习2

window.statue = "welcome to my web site!";  //browser status bar
window.open("userhelp.htm","_blank","height=300,width=200,toolbar=no,status=no,menubar=no,location=no");
//the preceding code will open a new browser window and direct it to the HTML file userhelp.htm.
//The code specifies a specific height and width for the window(300 by 200) and removes all
//toolbars,menu bars,and the status bar,leaving a sparse window.

window,resizeTo(640,480);//resize the browser to 640 pixels by 480 pixels tall.
window.moveTo(topLeftX,topLeftY);//reset the browser's location.
history.back().//back to previous web page.
history.go(-5);//send the browser back five pages.the number(-5) can be a positive number or a negative one.
              // a positive number goes forward and a negative one goes back.
history.forward();//go forward one item in the history list;simulates the Forward browser button.
-----------------location abject------------------
property name   purpose                                       example
href            gets or sets the entire URL as a string       location.href="http://www.example.com/another/page.htm";
hash            gets or sets the portion of the URL after the hash sign(#)
host            gets or sets the hostname and port number portion of the URL
hostname        gets or sets the hostname portion of the URL
pathname        gets or sets the filename or path of the web page.
port            gets or sets the port number portion of the URL.
protocal        gets or sets the web protocal name of the URL(e.g.,HTTP).
search          gets or sets the portion of the URL after the question make(?).
Method Name     Purpose
assign          load a new web page.
reload          reloads the existing web page.
replace         replace the existing web page by loading a new web page.
---------------------RGB----------------------------
format: #XXXXXX
the color #FF33C0 represents a combination of bright red,dark green,and medium blue.
#FFFFFF represents pure white , and #000000 represents pure black.
----------------------js------------------
document.getElementsByTagName("input");
document.getElementById("");
document.getElementsByName(""); 
elementId.style.backgroudColor = "black";
elementId.style.color = "white";
elementId.style.font = "22pt Arial";
document.write("");
Array.pop(),Array.push() //similar to a stack
Array.shift(),Array.unshift()//similar to a call queue
cancat(array1,array2,array2...arrayN);//joins two or more arrays into a single array
Array.join(separator) //joins all the elements of an array into a single string ,separated
                //by the separator indicated or a comma if none is specified.
Array.reverse();
Array.slice(begin,end);//creates a new array from a subsection of the existing array.
Array.splice(index,howMany,element1,element2...elementN);//used to add or removed
       //elements from array.
sort(functionName);//used to sort the elements of an array.
new StaticArray[datatype](); ,new StaticArray[datatype](size);new StaticArray();new StaticArray(size);
new ConstArray[](); new ConstArray();
try {
} catch (e) {
 if(isIE) {
  alert(e.description);
 } else {
  alert(e);
 }
}

try {
}
catch () {
}
finally {
}
var i = parseInt("123"); // string to int
var f = parseFloat("123.23");// string to float
Use the IE Error Object
number: a numeric value related to the error.
description: a string describing the error.
var myerr = new Error(100,""); 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值