accessing javascript entities in html

I

ian ward

Hello,

I want to show the result of some JavaScript on an HTML page. I've had
a look at some threads and it seems the conclusion is the following -
javascript entities are usable on the right-hand side of
attribute/value pairs (with some appropriate syntax involving curly
brackets and ampersands) and, furthermore, this only works for
attributes of "link type" html elements. If this is the case then I'm a

bit stuck, but I'd like to have that confirmed. If however you know of
any sort of workaround then I'd be very interested/grateful to hear it.



Many thanks in advance
Ian
 
M

Martin Honnen

ian said:
I want to show the result of some JavaScript on an HTML page. I've had
a look at some threads and it seems the conclusion is the following -
javascript entities are usable on the right-hand side of
attribute/value pairs (with some appropriate syntax involving curly
brackets and ampersands) and, furthermore, this only works for
attributes of "link type" html elements.

That seems like you looked at some old threads dealing with Netscape 4.
There is no support for "JavaScript entities" in newer browsers.

Use document.write to write out HTML markup dynamically while the
document loads. If you want to manipulate the document after it has been
loaded then you can nowadays manipulate text nodes, element nodes,
attribute nodes using the W3C DOM tree model.
 
I

ian ward

Martin Honnen a écrit :
That seems like you looked at some old threads dealing with Netscape 4.
There is no support for "JavaScript entities" in newer browsers.

Use document.write to write out HTML markup dynamically while the
document loads. If you want to manipulate the document after it has been
loaded then you can nowadays manipulate text nodes, element nodes,
attribute nodes using the W3C DOM tree model.

I'm not sure that will help as the data I want to see in the bowser is
looping on a timer - effectively it's a clock, and I can do this using
defaultStatus to display on the status bar but I don't want to do that,
I want it (them) in the middle of the page somewhere.

thanks
Ian
 
M

Martin Honnen

ian said:
I'm not sure that will help as the data I want to see in the bowser is
looping on a timer - effectively it's a clock, and I can do this using
defaultStatus to display on the status bar but I don't want to do that,
I want it (them) in the middle of the page somewhere.

Well in what world do you live (in terms of browsers)? IE 5 and later,
Opera 7 and later, Netscape 6 and later, Mozilla/Firefox and others all
do support
<div id="someDiv"></div>
and then e.g. (not most effective but simplest cross browser approach)
document.getElementById('someDiv').innerHTML =
'<p>Current date/times is ' + new Date() + '<\/p>';
That div or any other element can be anywhere on your page.

JavaScript entities or status bar manipulation are certainly something
from the past.
 
I

ian ward

Martin Honnen a écrit :
Well in what world do you live (in terms of browsers)? IE 5 and later,
Opera 7 and later, Netscape 6 and later, Mozilla/Firefox and others all
do support
<div id="someDiv"></div>
and then e.g. (not most effective but simplest cross browser approach)
document.getElementById('someDiv').innerHTML =
'<p>Current date/times is ' + new Date() + '<\/p>';
That div or any other element can be anywhere on your page.

JavaScript entities or status bar manipulation are certainly something
from the past.

Ok, I am a bit lost, Javascript is not my world, but I've been asked to
try to set this up.
Let's see, you've declared a div tag and....then what are doing? you're
setting its 'value' but where are you doing this, is it in some
javascript? So you can access an html elements from embedded
javascript?
Tell me to go away if these are very dumb questions!
Ian
 
L

lofty00

ian said:
Martin Honnen a écrit :


Ok, I am a bit lost, Javascript is not my world, but I've been asked to
try to set this up.
Let's see, you've declared a div tag and....then what are doing? you're
setting its 'value' but where are you doing this, is it in some
javascript? So you can access an html elements from embedded
javascript?
Tell me to go away if these are very dumb questions!
Ian

If you want a clock, you need to create a javascript function that
displays the current time, then set a timer to call that at intervals
using the 'window.setInterval()' method. Javascript functions can
either go inside your html in a <script
type="text/javascript">...</script> block, or in a separate file. (In
which case you need to have a block like this: <script
type="text/javascript" src="/path/to/your/script.js"></script>)

andy baxter
 
I

ian ward

(e-mail address removed) a écrit :
If you want a clock, you need to create a javascript function that
displays the current time, then set a timer to call that at intervals
using the 'window.setInterval()' method. Javascript functions can
either go inside your html in a <script
type="text/javascript">...</script> block, or in a separate file. (In
which case you need to have a block like this: <script
type="text/javascript" src="/path/to/your/script.js"></script>)

andy baxter

well, I'm using setTimeout() which I picked up from an OReilly book -
it isn't the clock itself which is directly giving me the problem, it's
being able to get at it from the HTML
thanks
 
R

Randy Webb

ian ward said the following on 6/14/2006 9:44 AM:
Martin Honnen a écrit :


Ok, I am a bit lost, Javascript is not my world, but I've been asked to
try to set this up.
Let's see, you've declared a div tag and....then what are doing? you're
setting its 'value' but where are you doing this, is it in some
javascript? So you can access an html elements from embedded
javascript?

You don't set its .value, you change its .innerHTML property.
 

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

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top