<script> inside <object>

J

John Smith

I'm trying to execute this HTML code:

<object classid="..."
codebase="..." width="0" height="0"
align="center" hspace="0" vspace="0" VIEWASTEXT="">

<script type="text/javascript">
alert("test");
document.myForm.btn.disabled = true;
</script>

<br><br> An error
occured during ActiveX installation. Possible reasons: ...
</object>

but JavaScript part simply doesn't execute. :( Why? What should I do? :(

I'm using IE7 under WinXP SP2 and it simply ignores <Script> tags inside
<Object> tag. When page open I can see "An error occured during..." text
that is below <Script> tag.
 
T

Thomas 'PointedEars' Lahn

John said:
I'm trying to execute this HTML code:

As the HyperText Markup Language is not a programming language, it cannot be
executed, but only be parsed and the parsed result can be rendered eventually.
<object classid="..."
codebase="..." width="0" height="0"
align="center" hspace="0" vspace="0" VIEWASTEXT="">

The `object' element does not have a `VIEWASTEXT' attribute in Valid markup.

http://validator.w3.org/
<script type="text/javascript">
alert("test");

alert() is a method of Window objects, and should be called so:

window.alert(...);
document.myForm.btn.disabled = true;

Standards compliant and backwards compatible referencing would be

document.forms["myForm"].elements["btn"].disabled = true;
</script>

<br><br> An error
occured during ActiveX installation. Possible reasons: ...

It is ridiculous to assume that including an `object' element would
necessarily trigger the installation of an ActiveX/COM object. Many
user agents do not even support or need ActiveX for multimedia.
</object>

but JavaScript part

In IE, it would be a JScript part, as that is Microsoft's ECMAScript
implementation used there.
simply doesn't execute. :( Why?

One possible reason is that your HTML user agent ("browser") supports the
specified media object, and so will ignore the content of the `object'
element. Another reason is that the script code is executed but contains
errors.
What should I do? :(

Use Valid markup. Use standards compliant references. Place the `script'
element outside of the `object' element, but within the `head' or the `body'
element.
I'm using IE7 under WinXP SP2 and it simply ignores <Script> tags inside
<Object> tag. When page open I can see "An error occured during..." text
that is below <Script> tag.

Since the content of the element apparently is not ignored, it may be that
IE 7 for WinXP SP2 simply does not support the `script' element there; that
would however not conform to HTML 4.01 (no surprise here). It may as well
be that you have an non-syntactical error in your script code.

"Does not work" is a useless error description. [psf 4.11]

http://jibbering.com/faq/


PointedEars
 
J

John Smith

As the HyperText Markup Language is not a programming language, it cannot
be
executed, but only be parsed and the parsed result can be rendered
eventually.

Yeah, yeah, wise guy. :))
It is ridiculous to assume that including an `object' element would
necessarily trigger the installation of an ActiveX/COM object. Many
user agents do not even support or need ActiveX for multimedia.

I'm developing for IE7.
In IE, it would be a JScript part, as that is Microsoft's ECMAScript
implementation used there.

Blah, blah... :))
Use Valid markup. Use standards compliant references. Place the `script'
element outside of the `object' element, but within the `head' or the
`body'
element.

I can not place 'script' outside of 'object' tag because I need it to
disable a button in case ActiveX/COM was not installed properly. Is there
some other way to acomplish this?
 
T

Thomas 'PointedEars' Lahn

John said:
I'm developing for IE7.

My sincere condolences.
[...] Place the `script' element outside of the `object' element, but
within the `head' or the `body' element.

I can not place 'script' outside of 'object' tag because I need it to
disable a button in case ActiveX/COM was not installed properly.

Then you will need to check first whether or not your code has a
non-syntactical error.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,408
Latest member
AlenaRay88

Latest Threads

Top