這是JavaScript 權威指南上的說明,象我這種E文很爛的就能勉強看懂一下,並沒有對著翻譯,只是按照理解說明了下。string.substring(from,to)ArgumentsfromA nonnegative integer that specifies the position withinstring of the first character of the desired substring. 指定想要得到字串的開始位置,即索引(非負整數)toA
caller返回調用當前函數的函數的引用! The caller property is available only within the body of a function. If used outside a function declaration, the caller property is null.If the currently executing function was invoked by the top level of a JavaScript program,
注釋1:整個大背景是這個網頁的全部尺寸,中間的小框才是瀏覽器中的可見尺寸。這幅圖就是針對為文檔(document)的各個height、width、top、left所做的說明。注釋2:第二幅圖主要是針對網頁中一個div的各個屬性值所做的說明。“DIV element client area”是這個div元素的可見地區,“scroll area”是這個div內容原始大小,但是由於div的css所設定的高度寬度容不下它的內容,所以出現捲軸。下面還有張更混亂的,在網上流傳比較廣:
此效果來自藍色理想,這裡我只是放個Demo,方便自己以後研究。我已在代碼中添加了比較詳細的注釋,在這裡我只提幾點:1.Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->ie =!+'\v1' //號稱史上最短的IE判斷,的確夠短的!! 2.Code highlighting produced by Actipro CodeHighlighter
此題也是關於逆序數的,當然可以用歸併排序的方法,但是我注意到伺服器提供的資料量較小,最普通的方法應該都可以通過,所以就用了個逐個比較求逆序數的演算法,然後再用直接插入排序把DNA按逆序數大小排列起來,最後輸出。果真AC了,哈哈!源碼如下:Code highlighting produced by Actipro CodeHighlighter
網頁中擷取捲軸捲去部分的高度,可以通過 document.body.scrollTop 來擷取,比如使div跟著捲軸滾動:<div id="div" style="width:100px;height:100px;background:#ccc;position:absolute;"></div>window.onscroll = function (){ var div = document.getElementById("div"); div.style.