473,379 Members | 1,235 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Add OBJECT in DIV

Hi. I'm trying to add an OBJECT in an existing DIV after a certain
delay.

Here is my currend code :

<div id="dummy" style="position: absolute; visibility: visible; top:
10px; left: 10px; z-index: 5; cursor: default; height: auto; background:
white; width: 500px; padding: 5px; overflow: hidden;>
<script language="JavaScript"><!--
var code = document.createTextNode("<object width='400'
height='400' type='text/html' data='soon.htm'></object>");

var obj = findObject("dummy"); // findObject existing in a .js

setTimeout(function(){obj.appendChild(code);},6000 0);
//--></script>
</div>

The result is that after 60 seconds, the DIV contains the text
"("<object width='400' height='400' type='text/html' data='soon.htm'>
</object>" and not an interpreted object tag. How to add the object
rather than simple text ?
Nov 30 '05 #1
4 3340
Asterbing wrote:

| From: Asterbing <no@thanks.com>

As you wish.
PointedEars
Nov 30 '05 #2
In article <MP************************@news.tiscali.fr>, no@thanks.com
says...
Hi. I'm trying to add an OBJECT in an existing DIV after a certain
delay.


OK, done... Uless that the html file which has to be loaded in the
created <object> tag is well loded under Netscape 7 but not under IE6
nor Opera : the object remains empty (without soon.htm rendered).

Here is the new code :

<div id="dummy" style="position: absolute; visibility: visible; top:
10px; left: 10px; z-index: 5; height: auto; width: 300px; padding: 5px;
overflow: hidden;>
<script language="JavaScript"><!--
setTimeout(function()
{
var obj,elt;

elt = document.createElement("object");
elt.setAttribute("width","280");
elt.setAttribute("height","500");
elt.setAttribute("type","text/html");
elt.setAttribute("data","soon.htm");

obj = findObj("dummy");
obj.appendChild(elt);
},10000);
//--></script>
</div>
Nov 30 '05 #3
Asterbing wrote:
In article <MP************************@news.tiscali.fr>, no@thanks.com
says...
Hi. I'm trying to add an OBJECT in an existing DIV after a certain
delay.

OK, done... Uless that the html file which has to be loaded in the
created <object> tag is well loded under Netscape 7 but not under IE6
nor Opera : the object remains empty (without soon.htm rendered).

Here is the new code :

<div id="dummy" style="position: absolute; visibility: visible; top:
10px; left: 10px; z-index: 5; height: auto; width: 300px; padding: 5px;
overflow: hidden;>

------------------^

You are missing the closing quote.

<script language="JavaScript"><!--
The language attribute is deprecated, type is required. HTML comment
delimiters inside script elements are useless and potentially harmful.
setTimeout(function()
{
var obj,elt;

elt = document.createElement("object");
elt.setAttribute("width","280");
elt.setAttribute("height","500");
elt.setAttribute("type","text/html");
elt.setAttribute("data","soon.htm");
You may find it simpler to modify the properties of elt directly:

elt.style.width = '280px';
elt.style.height = '500px';
...
Though it doesn't fix the issue with IE.


obj = findObj("dummy");
obj.appendChild(elt);
},10000);
//--></script>
The script should be outside the div that you are trying to reference.
Some browsers may not allow you to get a reference to the div until all
the content is parsed.

</div>

Why not code the object in the HTML, then hide and display it using
script by changing its style object's display or visibility property?
Users without script will see the object directly, if you don't want
that, then hide it in the HTML and know that script-less surfers will
not see it.
<div id="dummy" style="position: absolute; visibility: visible; top:
10px; left: 10px; z-index: 5; height: auto; width: 300px;
padding: 5px; overflow: hidden;">
<object id="obj_01" type="text/html" data="soon.htm" width="280"
height="500"></object>
</div>

<script type="text/javascript">

var obj = findObj('obj_01');
if (obj && obj.style) {
obj.style.visibility = 'hidden';
setTimeout(function() {
obj.style.visibility = 'visible';
}, 60000);
};

// Just for the exercise.
function findObj (id){
return document.getElementById(id);
}

</script>
--
Rob
Nov 30 '05 #4
In article <MU****************@news.optus.net.au>, rg***@iinet.net.au
says...
Asterbing wrote:
In article <MP************************@news.tiscali.fr>, no@thanks.com
says...
Hi. I'm trying to add an OBJECT in an existing DIV after a certain
delay.

OK, done... Uless that the html file which has to be loaded in the
created <object> tag is well loded under Netscape 7 but not under IE6
nor Opera : the object remains empty (without soon.htm rendered).

Here is the new code :

<div id="dummy" style="position: absolute; visibility: visible; top:
10px; left: 10px; z-index: 5; height: auto; width: 300px; padding: 5px;
overflow: hidden;>

------------------^

You are missing the closing quote.

<script language="JavaScript"><!--


The language attribute is deprecated, type is required. HTML comment
delimiters inside script elements are useless and potentially harmful.
setTimeout(function()
{
var obj,elt;

elt = document.createElement("object");
elt.setAttribute("width","280");
elt.setAttribute("height","500");
elt.setAttribute("type","text/html");
elt.setAttribute("data","soon.htm");


You may find it simpler to modify the properties of elt directly:

elt.style.width = '280px';
elt.style.height = '500px';
...
Though it doesn't fix the issue with IE.



Thanks for the differents advices, but I can't hard-code this html part
in an hidden div just because this html part will differ from time to
time (says, every 10 mn), then it was because of this I had to reload a
different object's data using timeout.

Well, however, I've searched using Google and it seems it's an object
tag issue which doesn't allow to change data on fly in all browsers.

The solution is just to use iframe rather than object and modify its src
: that way, it works !
Dec 1 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
44
by: Steven T. Hatton | last post by:
This may seem like such a simple question, I should be embarrassed to ask it. The FAQ says an object is "A region of storage with associated semantics." OK, what exactly is meant by "associated...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
0
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.