473,387 Members | 1,575 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,387 software developers and data experts.

Updating a div with a block of javascript and causing reexecution of this javascript block?

Hi,

I got the following situation using the AC_Quicktime library.
Apple recommend to use a Javascript call to generate the OBJECT tag
(http://developer.apple.com/internet/ieembedprep.html).

I am storing String entries representing the innerHTML of a div that I
will update at runtime.
As a result, some of these string entries are actually loooking like:
<script language="JavaScript" type="text/javascript">
QT_WriteOBJECT_XHTML('sample.mov', '320', '256', '',
'autoplay', 'true',
'emb#bgcolor', 'black',
'align', 'middle');
</script>
and not like that:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="320" height="256"

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
align="middle" >
<param name="src" value="sample.mov" />
<param name="autoplay" value="true" />
<embed src="sample.mov" width="320" height="256"
pluginspage=http://www.apple.com/quicktime/download/
align="middle" autoplay="true" bgcolor="black" </embed>
</object>

Now my problem is that when I update tmy div via Javascript, I replace
the div.innerHTML by the string entry that I have retrieved.
Since in some cases these entries are Javascript blocks, I would want
them to execute but they are not when just replacing the innerHTML.
Obviously, because these are dynamic entries, I could not execute the
QT_ Javascript method call from my javascript function.

Is there any way to force reexecution of this block of javascript?

Thanks

Michael

Any idea?

Nov 2 '06 #1
14 2255
Simply dynamically creating a 'wrapper' div, and replacing this wrapper,
with the current one and then writing the output of the javascript into the
new wrapper div should do the job. This essentially creates a 'reset'.

We had been doing some dynamically stuff with media and 2d/3d viewings and
this is the same structure we use.

-CJ

<ma*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hi,

I got the following situation using the AC_Quicktime library.
Apple recommend to use a Javascript call to generate the OBJECT tag
(http://developer.apple.com/internet/ieembedprep.html).

I am storing String entries representing the innerHTML of a div that I
will update at runtime.
As a result, some of these string entries are actually loooking like:
<script language="JavaScript" type="text/javascript">
QT_WriteOBJECT_XHTML('sample.mov', '320', '256', '',
'autoplay', 'true',
'emb#bgcolor', 'black',
'align', 'middle');
</script>
and not like that:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="320" height="256"

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
align="middle" >
<param name="src" value="sample.mov" />
<param name="autoplay" value="true" />
<embed src="sample.mov" width="320" height="256"
pluginspage=http://www.apple.com/quicktime/download/
align="middle" autoplay="true" bgcolor="black" </embed>
</object>

Now my problem is that when I update tmy div via Javascript, I replace
the div.innerHTML by the string entry that I have retrieved.
Since in some cases these entries are Javascript blocks, I would want
them to execute but they are not when just replacing the innerHTML.
Obviously, because these are dynamic entries, I could not execute the
QT_ Javascript method call from my javascript function.

Is there any way to force reexecution of this block of javascript?

Thanks

Michael

Any idea?

Nov 2 '06 #2
VK

ma*****@gmail.com wrote:
I got the following situation using the AC_Quicktime library.
Apple recommend to use a Javascript call to generate the OBJECT tag
fn EOLAS issue I guess...
see
<http://groups.google.com/group/comp.lang.javascript/msg/dedadd8801c863d7>

also in this particular issue feel free to use document.write and any
other durty coding you want.

Nov 2 '06 #3
ma*****@gmail.com said the following on 11/2/2006 4:17 PM:
Hi,

I got the following situation using the AC_Quicktime library.
Apple recommend to use a Javascript call to generate the OBJECT tag
(http://developer.apple.com/internet/ieembedprep.html).
Yes, and it is the same "solution" provided by MS as a result of the
EOLAS suit.

<snip>
Now my problem is that when I update tmy div via Javascript, I replace
the div.innerHTML by the string entry that I have retrieved.
Since in some cases these entries are Javascript blocks, I would want
them to execute but they are not when just replacing the innerHTML.
Obviously, because these are dynamic entries, I could not execute the
QT_ Javascript method call from my javascript function.
Create a new script block and create the script element on the fly.
Search the archives for a function name of createJSFile() and you can
find many threads where it is explained.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 2 '06 #4
That will work nicely on Firefox but not on Safari

draken wrote:
Simply dynamically creating a 'wrapper' div, and replacing this wrapper,
with the current one and then writing the output of the javascript into the
new wrapper div should do the job. This essentially creates a 'reset'.

We had been doing some dynamically stuff with media and 2d/3d viewings and
this is the same structure we use.

-CJ

<ma*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hi,

I got the following situation using the AC_Quicktime library.
Apple recommend to use a Javascript call to generate the OBJECT tag
(http://developer.apple.com/internet/ieembedprep.html).

I am storing String entries representing the innerHTML of a div that I
will update at runtime.
As a result, some of these string entries are actually loooking like:
<script language="JavaScript" type="text/javascript">
QT_WriteOBJECT_XHTML('sample.mov', '320', '256', '',
'autoplay', 'true',
'emb#bgcolor', 'black',
'align', 'middle');
</script>
and not like that:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="320" height="256"

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
align="middle" >
<param name="src" value="sample.mov" />
<param name="autoplay" value="true" />
<embed src="sample.mov" width="320" height="256"
pluginspage=http://www.apple.com/quicktime/download/
align="middle" autoplay="true" bgcolor="black" </embed>
</object>

Now my problem is that when I update tmy div via Javascript, I replace
the div.innerHTML by the string entry that I have retrieved.
Since in some cases these entries are Javascript blocks, I would want
them to execute but they are not when just replacing the innerHTML.
Obviously, because these are dynamic entries, I could not execute the
QT_ Javascript method call from my javascript function.

Is there any way to force reexecution of this block of javascript?

Thanks

Michael

Any idea?
Nov 3 '06 #5
Michael said the following on 11/3/2006 6:21 PM:

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
That will work nicely on Firefox but not on Safari
Does Safari support createElement, appendChild and setting the .src or
..text property of that script element?

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.text = "alert('It Worked');
document.getElementById('scriptDiv').appendChild(n ewScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

When running that in Safari, do you get the alert, an error message, or
nothing?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 3 '06 #6
Randy Webb wrote:
Michael said the following on 11/3/2006 6:21 PM:

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
>That will work nicely on Firefox but not on Safari


Does Safari support createElement, appendChild and setting the .src or
.text property of that script element?

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.text = "alert('It Worked');
document.getElementById('scriptDiv').appendChild(n ewScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

When running that in Safari, do you get the alert, an error message, or
nothing?
newScript.text = "alert('It Worked');// missing closing quote mark.
newScript.text = "alert('It Worked')";

In Safari, nothing, no error, nothing.
Mick

Nov 4 '06 #7
mick white said the following on 11/3/2006 8:09 PM:
Randy Webb wrote:
>Michael said the following on 11/3/2006 6:21 PM:

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
>>That will work nicely on Firefox but not on Safari


Does Safari support createElement, appendChild and setting the .src or
.text property of that script element?

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.text = "alert('It Worked');
document.getElementById('scriptDiv').appendChild( newScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

When running that in Safari, do you get the alert, an error message,
or nothing?
newScript.text = "alert('It Worked');// missing closing quote mark.
newScript.text = "alert('It Worked')";
I remember that quote mark and obviously missed fixing it before posting :-\
In Safari, nothing, no error, nothing.
What about this code:

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.src = 'someFile.js';
document.getElementById('scriptDiv').appendChild(n ewScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

Where someFile.js is an external file (you will have to create it) with
an alert('It worked') in it?

Also, since you have Safari, can you test this page:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/index.html>

I don't have Safari listed there so if you could test it for me, I would
be grateful. What you should get is an initial alert when the page loads
that says "Initial File Loaded". Then there are three buttons across the
page. What happens when you click each? Also, what version of Safari and
what MAC OS you are using would be appreciated.

Anybody else that can test it and let me know OS, ver/rev browser and
what the results are so I can update it.

I may have to revisit it and change it to test for altering the script
elements .text property.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 4 '06 #8
Randy Webb wrote:
mick white said the following on 11/3/2006 8:09 PM:
>Randy Webb wrote:
>>Michael said the following on 11/3/2006 6:21 PM:

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

That will work nicely on Firefox but not on Safari

Does Safari support createElement, appendChild and setting the .src
or .text property of that script element?

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.text = "alert('It Worked');
document.getElementById('scriptDiv').appendChild (newScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

When running that in Safari, do you get the alert, an error message,
or nothing?
newScript.text = "alert('It Worked');// missing closing quote mark.
newScript.text = "alert('It Worked')";


I remember that quote mark and obviously missed fixing it before posting
:-\
>In Safari, nothing, no error, nothing.


What about this code:

<script type="text/javascript">
function loadJSFile(){
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.src = 'someFile.js';
document.getElementById('scriptDiv').appendChild(n ewScript);
}

window.onload = loadJSFile;
</script>
<div id="scriptDiv"></div>

Where someFile.js is an external file (you will have to create it) with
an alert('It worked') in it?
This works.
>
Also, since you have Safari, can you test this page:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/index.html>
>
I don't have Safari listed there so if you could test it for me, I would
be grateful. What you should get is an initial alert when the page loads
that says "Initial File Loaded".
This works.

Then there are three buttons across the
page. What happens when you click each?
Create element // alerts "createElement worked"
Change innerHTML and Change Source // Nothing, no errors

Also, what version of Safari and
what MAC OS you are using would be appreciated.

Mac OS 10.3.9, Safari 1.3.2 (v312.6)

Mick
Nov 4 '06 #9
VK
Mac OS 10.3.9, Safari 1.3.2 (v312.6)

Anything below Safari 2.0 is irrelevant for the web-development.

It is not a bias: just the plain technical true. Just to give you a
touch of how low initially was it: 1.1. (not some 0.1) was hanging up
on any attempt to use JavaScript.

P.S. Do you still want another better world, man? Go get it in 3D,
we'll try to help ye...

Nov 4 '06 #10
VK wrote:
> Mac OS 10.3.9, Safari 1.3.2 (v312.6)


Anything below Safari 2.0 is irrelevant for the web-development.
What a stupid statement.
Mick
Nov 4 '06 #11
mick white said the following on 11/4/2006 8:26 AM:
Randy Webb wrote:
<snip>
Then there are three buttons across the
>page. What happens when you click each?
Create element // alerts "createElement worked"
Change innerHTML and Change Source // Nothing, no errors

Also, what version of Safari and
>what MAC OS you are using would be appreciated.


Mac OS 10.3.9, Safari 1.3.2 (v312.6)
Thank you, I have it updated locally and will update it online sometime
tonight.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 4 '06 #12
mick white said the following on 11/4/2006 2:48 PM:
VK wrote:
>> Mac OS 10.3.9, Safari 1.3.2 (v312.6)


Anything below Safari 2.0 is irrelevant for the web-development.

What a stupid statement.
Mick, meet VK :) 99.99% of what he says falls into that category.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 4 '06 #13


on Mac OS 10.4 with Safari 2.0.4, when I hit
http://members.aol.com/_ht_a/hikksno...ile/index.html, I
get the following:

CreateElement : I get the alert
Change Source or innerHTML : nothing, no error, no alert

Hope that helps

Michael

On Nov 4, 1:09 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
mick white said the following on 11/4/2006 2:48 PM:
VK wrote:
> Mac OS 10.3.9, Safari 1.3.2 (v312.6)
Anything below Safari 2.0 is irrelevant for the web-development.
What a stupid statement.Mick, meet VK :) 99.99% of what he says falls into that category.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Nov 5 '06 #14
Michael said the following on 11/4/2006 10:06 PM:
>
on Mac OS 10.4 with Safari 2.0.4, when I hit
http://members.aol.com/_ht_a/hikksno...ile/index.html, I
get the following:

CreateElement : I get the alert
Change Source or innerHTML : nothing, no error, no alert

Hope that helps
It did. Do you happen to have a browser that isn't listed on that page?
The more comprehensive that I can make that list the better.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 5 '06 #15

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

Similar topics

3
by: Daniel Pryde | last post by:
Hi there. I hope this isn't a stupid question to ask, but does anyone know how to print out a string without moving to a new line each time and simply updating the first line. An example would be,...
6
by: mkobus | last post by:
Im relatively new, so please be patient with me... I need to update a parent .aspx screen from a popup and close the popup. Normally I would use...
4
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
5
by: Ryan Ternier | last post by:
I'm having an issue with an SQL insert statement. It's a very simple statement, and it's causing too much fuss. strSQL = "INSERT INTO tblFieldLayouts(TypeID, FieldID, OrderID, Hidden) VALUES("...
1
by: Arthur Dent | last post by:
Hello all, sorry for the cross-post, but im not sure which group is best for this question. I am an ASP.NET developer, but am learning PHP/perl for the first time now to make some to changes to...
3
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
3
by: querry | last post by:
Hi there, I have a problem. I am devloping a C# ASP.NET User Control (a .ascx file). I want to display a table on the user control. This table is generated on the fly. First the...
2
by: jackson.rayne | last post by:
Hi, I have created a sample page that is validated by validator. Please see it at http://www.shopperdesire.com/index_temp.php I need to know what is causing the white space between the two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.