0

I have an issue with using <object>. I need it to show different external pages, but it's not really working for me. It is like, after the first time I set Data, changing it does nothing. Do I need to refresh it, somehow?

This is my jQuery code to change the data:

$("#content").attr('data', urls[urlIdx]);

And my object:

<div id="Main" style="width:100%;height:100%;">
    <object id="content" style="width:100%;height:100%;"/>
</div>

Simple stuff.

urls is an array of urls, and urlIdx is a counter that I increment.

Edit: I have made this jsfiddle: http://jsfiddle.net/fJQm6/

Basically, the first time the tick executes, the object's data is set, but the subsequent ticks changes nothing.


Passing self as parameter in Delphi

I would like to pass "self" as parameter to a method of another class (in a different unit). However the type of the first class is unknown in the second one, because I can't put the first unit into the uses section of the second unit. So I define the parameters type as pointer but when I try to call a method from the first class the Delphi 7 parser tells me that the classtyp is required.

So how should I solve this problem?

4

2 に答える 2

0

HTML のオブジェクト タグのデータ コンテンツの変更の重複の可能性

var divEl = document.getElementById('Main');
var objEl = document.getElementById('content');
objEl.data = newUrl; //you can use aray logic here
// Refresh the content
divEl.innerHTML = divEl.innerHTML;

Jquery の使用

$("#content").attr('data', urls[urlIdx]);
var $mainDiv=$("#Main");
$mainDiv.html($mainDiv.html());

ここで更新されたライブjsfiddle http://jsfiddle.net/fJQm6/3/

于 2013-04-24T11:26:58.150 に答える