English 中文(简体)
• 计算 Java原物体的功能?
原标题:Enumerate JavaScript objects functions?

我愿列举在贾瓦古斯塔文创建的各种古典物体和甚至超文本元素的所有现有功能。 例如, Chrome和Fox的以下著作:

<html>
    <body>
    <script>

        var object = document.createElement( "select" );

        for( var prop in object )
        {
            document.body.innerHTML += "" + prop + "; // " + typeof object[prop] + "<br/>";
        }

    </script>
    </body>
</html>

This outputs all the properties of the object including the functions available to that object, e.g.:

...
insertAdjacentHTML; // function
insertAdjacentText; // function
insertAdjacentElement; // function
getAttribute; // function
setAttribute; // function
removeAttribute; // function
getAttributeNode; // function
...

然而,这在E9中不会奏效,因此,你们所获得的都是扼杀/编号/目标特性,从来都不是任何功能特性。

我的问题是,我如何在运行的时候发现,E9的物体出口哪些功能名称?

很多人预先表示感谢。

UPDATE: adding a doctype gets this working as expected.

<!DOCTYPE html>
    <body>
    <script>

        var object = document.createElement( "select" );

        for( var prop in object )
        {
            document.body.innerHTML += "" + prop + "; // " + typeof object[prop] + "<br/>";
        }

    </script>
    </body>
</html>
最佳回答

这部法律令我感到 fine荣,在这里,法国第9号法典中做了功劳。

http://jsbin.com/ivukus/edit#preview

问题回答

如果你具体说明了DOCTYPE,这将在互联网上进行罚款。 如果没有, IE将在Quirks Mode上提供,这主要是IE 5.5的行为,这将极大地影响IE s Javascript support。

<!doctype html>
<html>
    <body>
    <script>

        var object = document.createElement( "select" );

        for( var prop in object )
        {
            document.body.innerHTML += "" + prop + "; // " + typeof object[prop] + "<br/>";
        }

    </script>
    </body>
</html>

结果:

form; // object
length; // number
multiple; // boolean
name; // string
options; // object
selectedIndex; // number
size; // number
type; // string
value; // string
dataFld; // string
dataFormatAs; // string
dataSrc; // string
add; // function
item; // function
namedItem; // function
remove; // function
.
.
.




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签