Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / October 2007



Tip: Looking for answers? Try searching our database.

JScript equivalent of getElementById

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daan - 31 Oct 2007 14:44 GMT
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
Martin Honnen - 31 Oct 2007 14:48 GMT
> I want to transform the following JavaScript code to JScript, but I
> cannot find any good resources on it. Can you help me?
[quoted text clipped - 5 lines]
>
> 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.

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/

Daan - 31 Oct 2007 14:54 GMT
> 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
Martin Honnen - 31 Oct 2007 15:04 GMT
> 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.

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/

Thomas 'PointedEars' Lahn - 31 Oct 2007 16:48 GMT
>> document.getElementById is not a JavaScript function nor a JScript
>> function, it is a method of a DOM object implemented in browsers like IE
[quoted text clipped - 4 lines]
> 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
Signature

Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

SAM - 31 Oct 2007 23:31 GMT
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>

Signature

sm

Stevo - 31 Oct 2007 15:30 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.