Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / October 2003

Tip: Looking for answers? Try searching our database.

using external javascript.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr. x - 26 Sep 2003 13:46 GMT
Hello,

I want to make my code less spagetty code one.
The script on my html includes internally javascript, which works fine :
<script type="text/jscript">
// ... my code ...
</script>
...
When I put my code between the script to external file, there is no response
from the functions in <script> section, I have called .

My script is in javascript and include in the first lines :
var ...
var ...

function myfunc()
{
}
....

in the html I wrote :
<script lanuage = "javascript" src = "myscript.js">
(in myscript.js I have copied what is between the <script> tags).

1) What is the problem in my code ? - Are there any limitation in external
javascript ?
2) If I want that "myscript.js" will reference to another javascript - how
can I do that ?

Thanks :)
name - 27 Sep 2003 07:22 GMT
"external "

Definition?

"copied "

good

========

Good luck

> Hello,
>
[quoted text clipped - 26 lines]
>
> Thanks :)
Peter Torr \(MS\) - 28 Sep 2003 05:43 GMT
> in the html I wrote :
> <script lanuage = "javascript" src = "myscript.js">
> (in myscript.js I have copied what is between the <script> tags).

Hi,

> 1) What is the problem in my code ? - Are there any limitation in external
> javascript ?

You must add the closing </script> tag.

> 2) If I want that "myscript.js" will reference to another javascript - how
> can I do that ?

No, there is no direct way of doing this. There are hacky workarounds (like
creating dynamic script blocks and setting the src, or cracking open an
XMLHTTP object and eval-ing the download.... but don't go there.

Peter

Signature

Peter Torr - http://blogs.gotdotnet.com/ptorr/
This posting is provided "AS IS" with no warranties, and confers no rights
Samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

bruce barker - 01 Oct 2003 17:21 GMT
also if you use external script blocks, you should not call function until
page load, as the code may not yet be loaded.

> > in the html I wrote :
> > <script lanuage = "javascript" src = "myscript.js">
[quoted text clipped - 21 lines]
> Samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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



©2008 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.