Function To Load Files - With .txt Extensions
Mar 16, 2009
i have a function to load text files.
function load(n){textfile=n;if(n.indexOf("#")!=-1){theleft=n.indexOf("#")+1;textfile=(n.substring(theleft))}
document.mycall.load(textfile+'.txt');origString=textfile;
and it only loads a files with .txt extensions. how to change this function to load files with .doc and .nfo extensions also.
View 2 Replies
ADVERTISEMENT
Oct 20, 2009
I have several js files to include in Hml so was thinking if there is any way that i can includes all the files in one file and then include that file in the main html file so that i don't need to chnage the main file again and again
How can i do that just like we use import in css
View 5 Replies
View Related
May 20, 2011
Can any one let me know , how to load XML file with java script.
View 1 Replies
View Related
Apr 27, 2006
Consider the following code as seen in the Scriptaculous library:
Code:
require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
}
This will make the browser load more libraries, which is cool.
However, when using Content-Type application/xhtml+xml, Firefox gives an error in the JS Console:
Code:
Error: uncaught exception: [Exception... "Object cannot be created in this context" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://localhost/script/scriptaculous/scriptaculous.js Line: 26"]
It seems that XHTML 1.1 documents sent with the correct application/xhtml+xml cause Firefox not to like document.write(). Fair enough
How can I change the above code to inser the script through DOM? Would that be something like:
document.createElement('javascript');
View 3 Replies
View Related
Aug 4, 2009
trying to load a random swf files using setTimeout
</head><script type="text/javascript">
var numberOfSongs = 3
var sound = new Array(numberOfSongs+1)
[code]....
View 8 Replies
View Related
Aug 21, 2006
1. I create an HTML document that validates at w3c
2. I use:
<script language="JavaScript" type="text/javascript"
src="dashboard.js" ></script>
3. <body onload="something_in_dashboard_js()">
4. In Firefox, it works beautifully ( no shock )
5. In IE it does not ( no shock )
6. If i put the function in inline <scripttags in my HTML, the JS
runs fine (no syntax error).
View 5 Replies
View Related
Oct 24, 2011
I am using a 3 column layout. One column contains links and 2 columns contain content. I need to load the content to 2 Divs in one click. When a link is clicked it should load some file in column 2 and another file in column 3.
As of now I am loading only one div using jquery load function. But I need to load 2 divs. Below is the code Ib am using.
Or is there any other option to load 2 external files in 2 different div in one click
Example
Head
<script type="text/javascript">
$(document).ready(function(){
$('a.menu_links
[Code]....
View 2 Replies
View Related
Jun 14, 2011
unable to find through google or search here relevant answer to the question, so sorry if repetitiveI used this function provided by a member in this forum
[Code]...
View 1 Replies
View Related
Oct 26, 2010
I would like to make the following playlist dynamic by having it read a folder. code...
View 1 Replies
View Related
Jul 24, 2010
This is a weird idea I have- i will try to explain it all (forgive me if i do not).
i'm using xml to create dynamic content on the site i'm building for myself.
now, i know there is a way to randomly load xml content using php-
but i have zero experience with php (though i not afraid to learn it, if it is the only way to do this).
here's what i want to do:
i have (let's say) 4 "announcement" areas on a page, in addition to a "random info" bar off to the side. in each of these, i want to have randomly loaded xml content each time the page is refreshed/viewed.
so if i have a "recent site news" section on the page, i would have a folder for "some code" to look in to pull out an xml file to display. etc etc.
basically, i'm wondering if there is a java way to do this (perhaps similar to the choosePic function?). it doesn't have to load a different xml file each time the page is refreshed either- if there's a way to pick a set number of items from any xml file i specify- that would be ok too.
View 6 Replies
View Related
Sep 2, 2011
I'm trying to create a function to load a js file and instance a object.
I'm trying something like this:
Code:
function Load(element)
{
var e = document.createElement("script");
e.type = "text/javascript";
[Code]....
I'm creating the files with the same name as the object. I'm trying to load a file/object name Manager. It's loading the js file, but it says that the object does not exits.
What's the best way to load a js file and create the instance of the object dynamically?
View 1 Replies
View Related
Sep 8, 2011
This script fails to load any of the css files it refers to and I have no idea why... [code]...
View 6 Replies
View Related
Apr 20, 2009
I'm trying to load some javascript files via ajax, I can't get it to catch 404 errors. I've tried searching, but everything I've found says that I should check the status on the request object to catch it but it's not even getting that far.
I've tried:
I would try $.getScript, but that appears to have no way of handling errors. I've even tried just doing a console.info("test") -- it doesn't even do that. Firebug shows a 404 error (obviously) but the error doesn't seem to be being caught? I'm loading jquery through the google api, version 1.3.2.
View 3 Replies
View Related
Nov 30, 2011
Now I can successfully load the data from html files. I want to show these data in seperate div instead of replace them.
Here is my load() code, I add sliders in "scroll-pane".
How can I write my append() ??
View 2 Replies
View Related
Feb 15, 2010
I'm starting to use JQuery ajax and am seeing a second-2 delay in the loading of a line of text when I click on the link.
Here is the JQuery code
Content should load when the slideUp is done but it normally doesn't change the content till halfway through the slide down because of the delay.
I've tried without the slideup/down but it still has this delay.
The content to load is at most 8 words.
View 1 Replies
View Related
Jan 6, 2009
We use a variety of plugins on a wordpress site we're developping. But two of them seem to be conflicting, causing one not to load/work properly. One uses jQuery and the other one uses scriptaculous/prototype. It seems those two have some issues running together.
As jQuery is the default library loaded, is there a way (without modifying the $-function) to exclude jQuery from loading from this one page where Scriptaculous is needed?
View 5 Replies
View Related
Jun 8, 2011
This is my current script
<script type="text/javascript">
$(document).ready(function(){
$("div.content1").load("content_1.txt");
$("div.content2").load("content_2.txt");
[Code].....
What I'm trying to do is get the script to look for class names div.content"x" and then correctly load content_"x".txt
View 4 Replies
View Related
Jul 11, 2011
I have Win 7, IE9. I have a HTML file on my hard drive, with Javascript within. When I load the page, it keeps popping up Do u want to allow this content, I have to click to allow. I want to stop this, and after doing some searching I found the setting in Internet Options, Advanced - "Allow active content to run in files on my computer".
Perfect.
Doesnt work. When i check this box, the page loads without the warning, but then the Javascript just doesnt work.
Getting quite annoying, because this file is my home page.
View 6 Replies
View Related
Nov 6, 2007
I'd like to announce release 1.0.7 of JNEXT (JavaScript Native
Extensions). JNEXT is an open source framework for securely accessing
the full range of native OS resources (files, databases, sockets etc.)
by using JavaScript from within a Web Page. It is light weight, cross
platform, cross browser and designed with simplicity in mind....
View 3 Replies
View Related
Aug 18, 2005
Does anybody know of a good firefox extension tutorial?
Basically I have an XML list of things
<term>bleh</term>
<replacement>blehsky</replacement>
and I want to make the extension replace every occurance of bleh on the webpage with blehsky.
I can handle the javascript to do this, but I don't know where to start in making it into an extension.
View 6 Replies
View Related
Feb 7, 2006
I"m trying to do a search on a folder that contains both word docs and
html pages. I want the search to only return back the html pages.
Does anyone know the code for that?
View 3 Replies
View Related
Mar 2, 2011
I'm trying to create an extensible class with private members.
Suppose I have the following:
Code:
Obviously, only "y" should be available to instantiations:
Code:
But how can I now extend this class and still access the private properties inside the extension?
Code:
How do I access x there? The someOtherFunction extension is part of the prototype, so it should be in the same scope as someFunction, no?
View 1 Replies
View Related
Apr 27, 2004
I couldn't find a single thread with the creme de la creme of String prototype extension methods, so I figured I'd start one. Here we go!
String.prototype.lTrim = function () {
return this.replace(/^s+/gm, "");
}
String.prototype.rTrim = function () {
return this.replace(/s+$/gm, "");
}
String.prototype.trim = function () {
return this.rTrim().lTrim();
}Obviously, this one's easy to understand. I'm using multi-line mode so as only to get rid of spaces and tabs before and after words. Single-line mode would replace any newline/carriage return characters as well.
String.prototype.capitalize = function () {
return this.replace(/[a-z]/g, function (str, n) { return str.toUpperCase(); });
}
String.prototype.toCamelCase = function () {
return this.replace(/s[a-z]/g, function (str, n) { return str.toUpperCase(); });
}
String.prototype.unCamelCase = function () {
return this.replace(/[A-Z]/g, function (str, n) { return " " + str.toUpperCase(); });
}This is something I needed today, to turn a camelCased variable value into its Header Format. While I was at it, I wrote the un-do-er.
View 8 Replies
View Related
Dec 17, 2000
I have been using Frontpage to design web sites and know that online-forms can be created using Frontpage, but the host must have Frontpage Server Extensions installed...
...I was wondering if the online forms were simply CGI scripts??
If so, could i not get DreamWeaver Ultra Dev and write the CGI scripts in there? - I think DreamWeaver is capable of this?
Therefore, if a server supported CGI scripts and i had to pay extra for FRONTPAGE EXT. then i could bypass this problem by using CGI scripts...
...does this make sense? If not, why not?
View 1 Replies
View Related
Sep 10, 2009
Script works on the first attachment but not the other two?
<script type="text/javascript" language="JavaScript"><!--
function ExtensionsOkay() {
var extension = new Array();
var fieldvalue = new Array();
fieldvalue[0] = document.customApp.attachment_1.value;
fieldvalue[1] = document.customApp.attachment_2.value;
fieldvalue[2] = document.customApp.attachment_3.value;
extension[0] = ".doc";
extension[1] = ".docx";
extension[2] = ".txt";
extension[3] = ".pdf";
// No other customization needed.
for(var f = 0; f < fieldvalue.length; f++) {
var thisext = fieldvalue[f].substr(fieldvalue[f].lastIndexOf('.'));
for(var i = 0; i < extension.length; i++) {
if(thisext == extension[i]) { return true; }}
alert("Your upload field " + f + " contains an unapproved file name.");
return false;
}}
//--></script>
View 4 Replies
View Related
Feb 12, 2003
When introducing custom functionality to HTML elements we either use existing attributes to pass configuration parameters (like beetle's fValidate (http://www.peterbailey.net/fValidate/)) or invent our own (like my Tooltips (http://www.vladdy.net/webdesign/ToolTips.html)). While this method is ok for small amount of configuration information, it is not that flexible (you need to edit DTD) and becomes combersome when large amount of configuration parameters is needed.
I figured a more convinient way is to use a CSS like string to pass configuration parameters:
<div myextension="parameter1: value1; parameter2-subparameter1: value2.1; parameter2-subparameter2: value2.2"> </div>
Then initialization routine would contain:
if(myExtensionParameters = divElement.getAttribute('myExtension'))
divElement.myExtension = new myExtensionObject(divElement,myExtensionParameters);
Definition of possible parameters and their values can be done using an array of regular expressions:
myExtensionParamDefenitions = new Array();
myExtensionParamDefenitions['choiceparameter'] = /^s*(value1a|value1b|value1c)s*$/;
myExtensionParamDefenitions['stringparameter'] = /^s*(w+)s*$/;
myExtensionParamDefenitions['integerparameter'] = /^s*(d+)s*$/;
Constructor for the myExtensionObject would containd a parseParameters function:
function myExtensionObject(divElement,myExtensionParameters)
{ this.params=new Array();
parseParameters(this.params,myExtensionParamDefenitions,myExtensionParameters);
//Verify parameter initialization, if you like
str=''
for(e in this.params) str+= e + ': ' + this.params[e] + '
'
alert(str);
//Do whatever you have to do...
}
Function parseParameters has the following code:
function parseParameters(object,definitions,parameters)
{ paramEntries = parameters.split('');
for(var i=0; i<paramEntries.length; i++)
{ paramEntry = paramEntries[i].split(':');
if(paramEntry.length == 2)
{ paramName = paramEntry[0].replace(/^s*([w-]+)s*$/,'$1');
if(definitions[paramName])
{ res = definitions[paramName].exec(paramEntry[1]);
if(res[1])
object[convertCSSName(paramName)] = res[1];
}
}
}
}
Where convertCSSName function converts CSS type name (background-image) to javascript name (backgroundImage)
function convertCSSName(cssName)
{ sn = cssName.split('-');
rs = sn[0];
for(var i=1; i<sn.length; i++)
rs += sn[i].replace(/^(w)(w*)$/,function(str,p1,p2,offset,s){return p1.toUpperCase() + p2;})
return rs;
}
As a result you have params array of myExtensionObject object populated with validated entries. Changes and expansion is done by simply editing myExtensionParamDefenitions array.
PS: The functions are coded more for clarity rather than for brevity - I'm certain there are ways to improve the implementation.
View 3 Replies
View Related