saving and applying scripts

L

LA

Hi want to make sure I'm doing this right. Using FP 03.
What is the best way to copy and apply a script. Just add
it to the html code page? or save it in a file on my web
then somehow attach it?

Where do you save your scipts?

In behaviours I see in the drop down 'call script' should
I use this and if it's a matter of preferance; then how
do I use this correctly?

Thanks
 
L

Lisa Wollin \(Microsoft\)

Hi,

You can either place the code in the page that uses it, or if you need to
use the script in several different pages, you can put the code into a
separate script file (.js) and call it from each of the pages.

To add the script to an event, don't use the call script item in the
Behaviors task pane. Instead, just modify the HTML as needed to call the
script from the desired event.

Example:

===
1) Here's a simple script.

function functionname()
{
window.alert("message");
}

===
2) To add this script to your Web page, switch to Code view and paste it
between two Script tags, like so:

<script>
function functionname()
{
window.alert("message");
}
</script>

===
3) Then locate the element that you want to access the script and insert
the event that you want to fire the event, and then insert the function
name, like so:

<p onclick="functionname();">click here</p>


--
Lisa Wollin
Programmer Writer
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included code samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
 
L

LA

Thanks

'you can put the code into a
separate script file (.js) and call it from each of the
pages.'

ok how do you call it? and how do I save a .js

Thanks
 
S

Stefan B Rusynko

If you have a script - say
<script language="JavaScript" type="text/javascript"><!-- begin script

function .....
....

//end script --></script>

Copy the contents of the script to Notepad and Save it as yourscriptname.js in your FP Web
- only copy the part inside of the tags:

function .....
....

Then link it in the HEAD section of your page using:

<script language="JavaScript" type="text/javascript" src="yourpath/yourscriptname.js"></script>



| Thanks
|
| 'you can put the code into a
| separate script file (.js) and call it from each of the
| pages.'
|
| ok how do you call it? and how do I save a .js
|
| Thanks
|
| >-----Original Message-----
| >Hi,
| >
| >You can either place the code in the page that uses it,
| or if you need to
| >use the script in several different pages, you can put
| the code into a
| >separate script file (.js) and call it from each of the
| pages.
| >
| >To add the script to an event, don't use the call script
| item in the
| >Behaviors task pane. Instead, just modify the HTML as
| needed to call the
| >script from the desired event.
| >
| >Example:
| >
| >===
| >1) Here's a simple script.
| >
| >function functionname()
| >{
| > window.alert("message");
| >}
| >
| >===
| >2) To add this script to your Web page, switch to Code
| view and paste it
| >between two Script tags, like so:
| >
| ><script>
| >function functionname()
| >{
| > window.alert("message");
| >}
| ></script>
| >
| >===
| >3) Then locate the element that you want to access the
| script and insert
| >the event that you want to fire the event, and then
| insert the function
| >name, like so:
| >
| ><p onclick="functionname();">click here</p>
| >
| >
| >--
| >Lisa Wollin
| >Programmer Writer
| >Microsoft Corporation
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >Use of included code samples are subject to the terms
| specified at
| >http://www.microsoft.com/info/cpyright.htm.
| message
| >| >> Hi want to make sure I'm doing this right. Using FP 03.
| >> What is the best way to copy and apply a script. Just
| add
| >> it to the html code page? or save it in a file on my
| web
| >> then somehow attach it?
| >>
| >> Where do you save your scipts?
| >>
| >> In behaviours I see in the drop down 'call script'
| should
| >> I use this and if it's a matter of preferance; then how
| >> do I use this correctly?
| >>
| >> Thanks
| >>
| >
| >
| >.
| >
 
L

LA

Ok I've been copying the code and pasting it where noted
header or body. I've been copying and pasting word for
word. including <script> is that corect?

What do you mean by only copy

function .....
.....

and link it by

<script language="JavaScript" type="text/javascript"
src="yourpath/yourscriptname.js"></script>

?? Don't I just copy and paste it all together

Also; in behaviours I see in the drop down 'call script'
how does that work?

Thanks!
-----Original Message-----
If you have a script - say
<script language="JavaScript" type="text/javascript"><!-- begin script

function .....
....

//end script --></script>

Copy the contents of the script to Notepad and Save it
as yourscriptname.js in your FP Web
- only copy the part inside of the tags:

function .....
....

Then link it in the HEAD section of your page using:

<script language="JavaScript" type="text/javascript"
src="yourpath/yourscriptname.js"> said:
message news:[email protected]...
 
S

Stefan B Rusynko

My instructions are for converting to an External script file
You can also use the script (with the script tags the way you have it ) in the HEAD section




| Ok I've been copying the code and pasting it where noted
| header or body. I've been copying and pasting word for
| word. including <script> is that corect?
|
| What do you mean by only copy
|
| function .....
| ....
|
| and link it by
|
| <script language="JavaScript" type="text/javascript"
| src="yourpath/yourscriptname.js"></script>
|
| ?? Don't I just copy and paste it all together
|
| Also; in behaviours I see in the drop down 'call script'
| how does that work?
|
| Thanks!
|
| >-----Original Message-----
| >If you have a script - say
| ><script language="JavaScript" type="text/javascript"><!--
| begin script
| >
| >function .....
| >....
| >
| > //end script --></script>
| >
| >Copy the contents of the script to Notepad and Save it
| as yourscriptname.js in your FP Web
| >- only copy the part inside of the tags:
| >
| >function .....
| >....
| >
| >Then link it in the HEAD section of your page using:
| >
| ><script language="JavaScript" type="text/javascript"
| src="yourpath/yourscriptname.js"></script>
| >--
| >
| >_____________________________________________
| >SBR @ ENJOY (-: [ Microsoft MVP -
| FrontPage ]
| >"Warning - Using the F1 Key will not break anything!" (-
| ;
| >To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| >_____________________________________________
| >
| >
| message | >| Thanks
| >|
| >| 'you can put the code into a
| >| separate script file (.js) and call it from each of the
| >| pages.'
| >|
| >| ok how do you call it? and how do I save a .js
| >|
| >| Thanks
| >|
| >| >-----Original Message-----
| >| >Hi,
| >| >
| >| >You can either place the code in the page that uses
| it,
| >| or if you need to
| >| >use the script in several different pages, you can put
| >| the code into a
| >| >separate script file (.js) and call it from each of
| the
| >| pages.
| >| >
| >| >To add the script to an event, don't use the call
| script
| >| item in the
| >| >Behaviors task pane. Instead, just modify the HTML as
| >| needed to call the
| >| >script from the desired event.
| >| >
| >| >Example:
| >| >
| >| >===
| >| >1) Here's a simple script.
| >| >
| >| >function functionname()
| >| >{
| >| > window.alert("message");
| >| >}
| >| >
| >| >===
| >| >2) To add this script to your Web page, switch to
| Code
| >| view and paste it
| >| >between two Script tags, like so:
| >| >
| >| ><script>
| >| >function functionname()
| >| >{
| >| > window.alert("message");
| >| >}
| >| ></script>
| >| >
| >| >===
| >| >3) Then locate the element that you want to access
| the
| >| script and insert
| >| >the event that you want to fire the event, and then
| >| insert the function
| >| >name, like so:
| >| >
| >| ><p onclick="functionname();">click here</p>
| >| >
| >| >
| >| >--
| >| >Lisa Wollin
| >| >Programmer Writer
| >| >Microsoft Corporation
| >| >
| >| >This posting is provided "AS IS" with no warranties,
| and
| >| confers no rights.
| >| >Use of included code samples are subject to the terms
| >| specified at
| >| >http://www.microsoft.com/info/cpyright.htm.
| >| message
| >| >| >| >> Hi want to make sure I'm doing this right. Using FP
| 03.
| >| >> What is the best way to copy and apply a script.
| Just
| >| add
| >| >> it to the html code page? or save it in a file on my
| >| web
| >| >> then somehow attach it?
| >| >>
| >| >> Where do you save your scipts?
| >| >>
| >| >> In behaviours I see in the drop down 'call script'
| >| should
| >| >> I use this and if it's a matter of preferance; then
| how
| >| >> do I use this correctly?
| >| >>
| >| >> Thanks
| >| >>
| >| >
| >| >
| >| >.
| >| >
| >
| >
| >.
| >
 

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