How to add Java Script to my Front Page project

T

tmb

I want to put some Java Script into my Front Page 2000 project.

1 - How to add "onload="loadpage()" to the body?

Should I use Insert | HTML or just go to HTML view and type it in ? Or what?

2 - How to add the actual Java Script Code?

ditto as in 1 above.

3 - Do most browsers have Java Script enabled these days ? (Or is adding
Java Script a waste of time?)

thanks for any help.
 
J

Jon Spivey

Hi,
Better than 95% of users should have script enabled so it's safe enough to
use. To add an onload to the body tag you can do either
<body onload="someFunction();">
or
window.onload=someFunction;

Both do the same thing. It's best to go to HTML view and just type the code
in
 
M

MD Websunlimited

Hi TMB,

First does the script require that all elements of the page be rendered before execution? If so, then using the event handler onload
in the body tag is the way to go and it must be done via Code or HTML view. Otherwise, you could enter the script in-line with the
content.

HTH,
 
A

Andrew Murray

enabling javascript is at the discretion of the user - it is user/browser
controlled.
type in the script manually in code view
most javascripts go between the <head> and </head> tags, but read the
instructions that came with the script.
 
A

Andrew Murray

the onload=() might also be picked up by firewalls/pop-up blockers and therefore
not be displayed. Better off making it onclick=() then the user initiates the
popup and can decide whether to do so or not.
 
A

Andrew Murray

you don't need to add the script to each page, you can do it as an external
script (which is basically a text file in notepad with a "js" file extension.

The bit of code that does go in your page is (something like) :

<script language ="javascript" src="../scripts/yourscript.js">

then you call it the same way, and the site knows where to look for that function
in "yourscript.js".
 

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

Top