?
Solved

Ajax Updater: Where does prototype.js go?

Posted on 2007-10-01
6
Medium Priority
?
222 Views
Last Modified: 2008-01-09
Hi

Somebody told me that protype.js file must go in the same directory as the page that's using it.

Does this mean the same directory as the html page or as the external javascript file that refers to it?

Can somebody clarify the rules please?

Thanks
0
Comment
Question by:Lady_M
  • 4
  • 2
6 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 19994006
The prototype.js file doesn't need to be in a specific folder in relation to the main page.  Where is the tag that "links" to the file?  The file is an external js file and should be "linked" in the main html page, not in another external js file.

Let me know if you have a question about this.  If you need help with the path to use then let me know the folder structure so I can be specific on the path to use.  The file doesn't need to be in the same folder or any specific folder though.

bol
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 19994023
In case you already have an external js file and want to also use prototype the correct way to do this is with something like the following code in the main (html) page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

<title>Untitled</title>

<script type="text/javascript" src="/path/to/prototype.js"></script>
<script type="text/javascript" src="/path/to/otherJavascriptFile.js"></script>
</head>

bol
0
 

Author Comment

by:Lady_M
ID: 19994211
Okay thanks.  So two questions:
does the doctype have to be transitional?  and is it important that the link to the prototype external file comes before the other external js file that will call it?  I presume so.

BTW. on a slightly different but related issue,  I have a window.onload call in the head of my html page which calls the function in my external js file (which then uses the Ajax updater).  IE6 is having none of it.  It doesn't recognise the existance of the external js file it seems.  Any ideas?

Thank you
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 19994828
>> does the doctype have to be transitional?

No.  The code was just to show you what the tags would look like for the external js files if you use prototype and another.  The other html was just to show placement.

>> and is it important that the link to the prototype external file comes before the other external js file that will call it?  <<

It wouldn't matter unless the other external file used something from prototype.js.  You hinted that this may be the case so I listed the prototype file first intentionally.  Depending on the contents of each this may not be an issue at all.  However if one depends on another then the order could be important.  It is best not to have the depend on each other though; the html page or main page is the one that should need the files, not one of the other files.

Where is the line or script with the onload?  Where is the script tag in relation to it?  Make sure the onload is below and script tags calling external js files.  One other caution is when more than one script needs the window.onload line.  They will overwrite each other.  This might be the issue here.  If that is the case then you will need to make a new function that will be called on page load which will call each of the functions.

I hope that helps but if you need more help with the new issue then you should open a new question.  If you do please post the URL here so I can look at it too.  I might have more to contribute.

Let me know if you have a question about any of the comments for this issue.  I'll be happy to provide whatever I can.

bol
0
 

Author Comment

by:Lady_M
ID: 19994865
Hi, thanks for that.  I think I understand the prototype now at least.

Re the other problem, I've been discussing it here: http://www.experts-exchange.com/Software/Internet_Email/Web_Browsers/Q_22863334.html
The url in that thread has been updated numerous times now though so won't be strictly relevant to it.  But any help would be much appreciated.  Thanks again.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 19994875
Your welcome!  I'm glad I could help.  Thanks for the fun question, the grade and the points.  I'll look at the other question and post if I can help/contribute.

bol
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question