JScript equivalent of getElementById

D

Daan

I want to transform the following JavaScript code to JScript, but I
cannot find any good resources on it. Can you help me?

In javascript, this is the code:

document.getElementById('externalText').innerHTML = "some
<strong>html</strong> code";

How can I transform this to JScript? Is there a similar getElement
function? Is there another way to traverse the HTML DOM? Thanks for
any help.
Daan
 
M

Martin Honnen

Daan said:
I want to transform the following JavaScript code to JScript, but I
cannot find any good resources on it. Can you help me?

In javascript, this is the code:

document.getElementById('externalText').innerHTML = "some
<strong>html</strong> code";

How can I transform this to JScript?

document.getElementById is not a JavaScript function nor a JScript
function, it is a method of a DOM object implemented in browsers like IE
5 and later, Netscape 6 and later. So simply continue to use
document.getElementById, IE exposes that to your JScript as well as
VBScript.
 
D

Daan

document.getElementById is not a JavaScript function nor a JScript
function, it is a method of a DOM object implemented in browsers like IE
5 and later, Netscape 6 and later. So simply continue to use
document.getElementById, IE exposes that to your JScript as well as
VBScript.

The problem is, I need to run the script in a WebBrowser control from
within a Managed .NET Compact Framework application. Using JavaScript
is not allowed in that environment (or at least not the script I try
to run), so I want to try if JScript *is*. Ultimately, what I want to
accomplish is to display text that was previously hidden when a link
(or button) was pressed.

Daan
 
M

Martin Honnen

Daan said:
The problem is, I need to run the script in a WebBrowser control from
within a Managed .NET Compact Framework application. Using JavaScript
is not allowed in that environment (or at least not the script I try
to run), so I want to try if JScript *is*. Ultimately, what I want to
accomplish is to display text that was previously hidden when a link
(or button) was pressed.

I have no idea which DOM the WebBrowser control in the .NET Compact
Framework supports. You could try whether
document.all["elementId"]
works if
documen.getElementById("elementId")
does not.
As said, it is not a question of JScript versus JavaScript, it is a
question of the DOM implementation the browser (control) offers.
 
S

Stevo

Daan said:
I want to transform the following JavaScript code to JScript, but I
cannot find any good resources on it. Can you help me?

I can do that for a flat fee of 17.4 million dollars. Quite reasonable I
think.

Oh, btw, JavaScript is the same as JScript. Microsoft only called it
JavaScript because of worries about trademark/copyright infringement.
Same reason they called their Java implementation J++.

Or in other words, it's already JScript.
 
T

Thomas 'PointedEars' Lahn

Daan said:
The problem is, I need to run the script in a WebBrowser control from
within a Managed .NET Compact Framework application.

I don't know your environment. However, from the ".NET" part in the name I
would conclude that it is pretty unlikely that the supported ECMAScript
implementation was (Netscape/Mozilla.org) JavaScript, as it is *Microsoft*
".NET".
Using JavaScript is not allowed in that environment (or at least no
the script I try to run),

It would help a great deal for an analysis if you not only named that script
but posted the offending lines of source code.
so I want to try if JScript *is*.

ISTM you have several misconception here, of which one Martin already
clarified. JavaScript and JScript are different programming languages, but
they are both ECMAScript implementations (which is what makes them look
similar). However, I have yet to see an execution environment that supports
both implementations. Usually you find JScript supported by Microsoft
applications and JavaScript by Netscape/Mozilla.org applications.
Ultimately, what I want to accomplish is to display text that was
previously hidden when a link (or button) was pressed.

How, exactly?


PointedEars
 
S

SAM

Daan a écrit :
The problem is, I need to run the script in a WebBrowser control from
within a Managed .NET Compact Framework application. Using JavaScript
is not allowed in that environment

Probably not with IE but ...

CSS :
=====

..truc { display: block; position: relative;
width: 70px; border: 3px outset;
text-align: center; text-decoration: none;
}
..truc:hover { color: orange; border-style: inset }
..truc span {
display: none;
position: absolute;
top: 10px; left: 50px;
padding: 6px; width: 60px;
border: 1px solid; z-index: +1;
}
..truc:hover span, .truc:focus span { display: block }

HTML :
======

<a class="truc">click me
<span>something here hidden/shown </span> </a>
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top