Topic awaiting preservation: How can I set embedded objects via script? |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 10-01-2002 20:51
I need to set the following, but only in a function: code: <!-- START MSN MESSENGER SCRIPTS //-->
|
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 10-01-2002 20:58
What do you mean "set" it? Insert it? You could use innerHTML, or document.createElement('object'); along with setAttribute to create the elements. |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 10-01-2002 21:05
The problem is that if I just insert the <object> stuff in the header, it launches MSN Messenger when a user comes to the page. I only want it to happen if they click a link, which, in turn, fires the function. |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 10-01-2002 21:51
Hmmm - I thought I understood what I read about this, but this isn't working - "null or not an object" error on the getElementById line code: <script type="text/javascript" language="javascript">
code: document.body.appendChild(newObject);
|
Paranoid (IV) Inmate From: [s]underwater[/s] under-snow in Juneau |
posted 10-05-2002 03:03
This is a bit of a workaround, but I have used it succesfully in the past for object/embed . Create a hidden I-Frame loaded with a blank HTML page. Set your onclick to load a page with your object/embed into the I-Frame. Not a very elegant solution, but it works. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 10-05-2002 08:26
I believe this specific problem is caused by an IE bug: setting the ID of an element with setAttribute doesn't make IE recognize it's ID. |
Nervous Wreck (II) Inmate From: Australia |
posted 10-05-2002 22:31
you might try creating some varaibles and then using those variables in setAttribute() as i suspect all the : in your code are causing the error to be thrown; heres something I do with a dynamically generated iframe that demonstrats creating a variable and then stuffing it in setAttribute() |