0

I have this code on jsfiddle.

HTML:

<object type="text/html" data="http://www.w3.org/" style="width:100%; height:100%;position: absolute;bottom: 0;"></object>

JS:

console.log($('object').find('*').length);

In tag there is strange #document tag and I can't find any tag in there Console says, that there are zero elements.

How can I read from DOM in <object>? What is #document in <object>?


How to pass complex params into controller?

This is just my 2nd week on ASP.NET MVC

Basically I have a model called T_Users, in the view page I created a textbox for creating a new record into the database, below is the code:

<th scope="row" class="spec">Row</th>
<th scope="col" class ="nobg">@Html.TextBoxFor(A => A.Username)</th>
<th scope="col" class ="nobg">@Html.PasswordFor(p => p.Password)</th>
...            

How can the controller behind it can get the values? Obviously pass by /xx/xx/ID is not a efficient way.

4

1 回答 1

8

不要使用<object>元素来加载 HTML 文档。改用<iframe>s - 支持和 API 更好。

然后你可以使用

var frame_contents = $('iframe').contents(); 
console.log($(frame_contents).find("*").length);

…如果您从不同的来源加载文档,则会受到通常的跨来源安全限制。

于 2013-07-15T14:00:14.997 回答