PC Review


Reply
Thread Tools Rate Thread

2 or more scriptsin 1 page?

 
 
bacon_sandwich
Guest
Posts: n/a
 
      19th Jan 2004
I would like to put a second script into a page already
containing a script with a line of code inside the <head>
and <body> tags themselves. I need to know the correct
syntax to separate the two (not sure what to call them..)
reference (?) lines when I put the new script in.

Any ideas?! I've seen this before, and I know it's simple
but I can't remember what to use!

Fanks

.....beercansandwidge...
 
Reply With Quote
 
 
 
 
Steve Easton
Guest
Posts: n/a
 
      19th Jan 2004
Depending upon what the second script does, there
are a couple of different ways.
1. Combine the scripts. If the second script defines a function,
place the function in the first script, as a script can have several
"unrelated"
functions.

2. Place the script in an external .js file and call it like this:
<script type="javascript" src="extfile.js">
</script>

3. set it as a separate second script in the body.
The browser will keep them separate.

hth


--
95isalive
This site is best viewed..................
...............................with a computer

"bacon_sandwich" <(E-Mail Removed)> wrote in message
news:04d901c3de72$e55cd450$(E-Mail Removed)...
> I would like to put a second script into a page already
> containing a script with a line of code inside the <head>
> and <body> tags themselves. I need to know the correct
> syntax to separate the two (not sure what to call them..)
> reference (?) lines when I put the new script in.
>
> Any ideas?! I've seen this before, and I know it's simple
> but I can't remember what to use!
>
> Fanks
>
> ....beercansandwidge...



 
Reply With Quote
 
Jon Spivey
Guest
Posts: n/a
 
      19th Jan 2004
Hi,
something like this?
<script type="text/javascript">
function someThing(){
// stuff
}
function someThingElse(){
// stuff
}
</script>
<body onload="someThing(); someThingElse();">

--
Cheers,
Jon
Microsoft MVP - FP

"bacon_sandwich" <(E-Mail Removed)> wrote in message
news:04d901c3de72$e55cd450$(E-Mail Removed)...
> I would like to put a second script into a page already
> containing a script with a line of code inside the <head>
> and <body> tags themselves. I need to know the correct
> syntax to separate the two (not sure what to call them..)
> reference (?) lines when I put the new script in.
>
> Any ideas?! I've seen this before, and I know it's simple
> but I can't remember what to use!
>
> Fanks
>
> ....beercansandwidge...



 
Reply With Quote
 
Andrew Murray
Guest
Posts: n/a
 
      20th Jan 2004
just make sure each script has <script> and </script> tags, otherwise a blank
line is all you need (if this is what you're asking).

Also make sure each script doesn't have any variable names as another script.eg a
variable integer called "A" in one script will conflict if in another script
there is also a variable called "A"....this is a simplified explanation but is
probably more relevant if two scripts that might for example have similar
functions and by coincidence have variable names the same.

as well as variable names, make sure the function names are all different. if you
have two functions in two different scripts called for example get_local_time();
then of course a conflict is going to come up when you're calling the function -
it won't know which one, or else the browser will generate an error "duplicate
identifier" or such .



other than that I suppose you can have as many as you like.



"bacon_sandwich" <(E-Mail Removed)> wrote in message
news:04d901c3de72$e55cd450$(E-Mail Removed)...
> I would like to put a second script into a page already
> containing a script with a line of code inside the <head>
> and <body> tags themselves. I need to know the correct
> syntax to separate the two (not sure what to call them..)
> reference (?) lines when I put the new script in.
>
> Any ideas?! I've seen this before, and I know it's simple
> but I can't remember what to use!
>
> Fanks
>
> ....beercansandwidge...



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
page numbers in Word 2007 - skipping page number on first page John Goche Microsoft Word New Users 1 13th Nov 2009 04:04 PM
Inserting a page in Page Layout View or Page Break Preview tanner.robin@gmail.com Microsoft Excel Discussion 1 6th Jun 2008 02:52 PM
Setting the Page Title using local resources for a content page in a master page Laith Zraikat Microsoft ASP .NET 3 6th Jul 2006 02:23 AM
single page or page range printing for multi page emails in outlo. =?Utf-8?B?RGVsIFBhdWxzb24=?= Microsoft Outlook Discussion 1 26th Apr 2005 07:41 PM
Report footer on separate page; optionally hide it, reduce total page count by 1, and don't print last (blank) page L Mehl Microsoft Access Reports 2 18th Sep 2003 01:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:45 PM.