Importing Scripts
Jul 23, 2005Is there a way to 'include' javascript at runtime? I'm targeting most recent browsers in general, but at worst I'm looking for IE/Moz solutions.
View 2 RepliesIs there a way to 'include' javascript at runtime? I'm targeting most recent browsers in general, but at worst I'm looking for IE/Moz solutions.
View 2 RepliesI have the usual javascript include in my html file:
<script type="text/javascript" src="standard.js"></script>
Now within the file standard.js I would like to put another 'script tag', i.e. in standard.js we would have the line
<script type="text/javascript" src="another.js"></script>
Obviously, this is not the way to do it, but what is?
I am currently creating part of a system which does a simple import of
a CSV file using SQL Server with DTS. The front end to this is a web
based .NET (C#) app. Obviously when the CSV file is large, there is a
delay for the user receiving any feedback from the system. I therefore
want to do what I have seen other systems do and display a gif image to
show the user that something is happening (eg. spinning images etc).
I will need to import jquery through flash, but I'm not the owner of the site, so I can't alter the code permanently, I'll have to do it "on the fly"
I wanted to add a child to the head element but I don't manage to do it!here is the code I'm doing as a test.[url] (jquery and the html page are in the same folder)
If instead of the jquery js I import any other js created by me with, e.g. an alert, this works. Why not with the jquery file?
An application under development has a set of core functions that carry out common tasks and a 'machine' that animates panels of lists of names and menus and provides another panel for action calls. (see attached pic). Selection of a name identifies object(s) to be worked on and menu couplets like "Name+Edit" call devices (each in a separate js file).
Each js file replaces any files in the deviceScript holder in the hta file. I used to use eval(couplet+"Start")() to initiate the device, but having read about the evils of eval it dawned on me that it was unnecessary and just gave each device a start() function ... and also an optional refresh(), and compulsory finish() to pick up results and clean up.This seems to work well on my machine. The hta is intended to run locally picking up json type data and devices locally and via the net.
OK, this little code takes a string (URL) input and returns an array ([fileContents,httpHeaders]).
function getFile(n){
var file; // Define variable
if(n==''||n==self.location)return []; // Don't request self or empty strings (Safety meassure for some IE and pre0.9.9 Moz versions)
switch(typeof ActiveXObject){
case 'function': // Chech if ie
file=new ActiveXObject('Microsoft.XMLHTTP'); // If so use ie XHreq
break;
default:
file=new XMLHttpRequest; // Otherwise use moz XHreq
file.overrideMimeType("text/xml"); // And override content-type to avoid breakage
}
try{// Error susceptible code (Moz may screw up, especially if you're breaking the security rules)
f.open('GET',n,false);// Open connection
f.send('')// Send empty string
}catch(e){// If error
return []// ...return empty null-length array
}
return [f.responseText,f.getAllResponseHeaders()]// Otherwise return response and http headers
}
Note that the file must be within the current domain, or only ie5.5win will actually be able to fetch it....
I have a function on my site where it imports links from from a text file and automatically changes the links around and inserts them into the database, filling up the necessary fields in the database.
I would like .zip to be taken off the end of each link where there is .zip at the end of the links.
Here is an example:
Will end up as:
Yamaha YFZ - 450 1999 Service Repair Manual.zip (This is due to the code replacing _ with a space and inserting a space when it goes from lowercase to higher. There are more rules this is just used as a example)
What I need is for the .zip to be removed, e.g: Yamaha YFZ - 450 1999 Service Repair Manual
Check out the code below:
I'm brand new to jQuery, so I apologize if this is a 101 question, but I'm trying to sort out a production issue. I do QA for an ecommerce website. When one of our developers made some changes to our application recently, a couple of the plugins we use stopped working on those pages. Looking at the code, it seems we load jQuery 1.4 and several plugins, including autocomplete and popdown. In the changes, for some reason, the developer loads jQuery 1.4.2 (after 1.4 has been called) but doesn't call the plugins again. I'm assuming that this is the reason the plugins stop working. Can anyone confirm this theory?
(The reasons why we don't call 1.4.2 earlier in the document are, sadly, mostly bureaucratic. If I can get this confirmation, hopefully I can push through that.)
I am still new to jQuery and I am trying to figure something out. I have this code:
[Code]...
This is working fine on itself. What is does is when I click a link it loads data into the following div. When done loading it slides out. But I want to change the appearance of the slide. I have tried to do that like this: $(this).show("slide", { direction: "down" }, 1000); But this doesn't work. When I check firebug it says the following: o.easing[this.options.easing || (o.easing.swing ? "swing" : "linear")] is not a function