Loading Text From An External File?

Feb 27, 2009

I'm currently working on a site and need to have a small section that displays 5 or 6 headlines. The same headlines will displayed on various pages and will occassionally be updated.

The site pages are static .html in design and i'd prefer to keep it that way rather than start introducing php for such a minor part of the site.

I am wondering if there is a javascript solution to this, whereby the headlines could be loaded via a .txt / .xml document or something similar?? That way i could just manually update the file and reload it to the server and the headlines would be updated.

I guess i'm think something similar to cushyCMS but that i can implement directly.

View 20 Replies


ADVERTISEMENT

Loading A String From An External File

Jul 23, 2005

i was wondering if it is possible to load text into a string from an
external text file. the reason is that i have a very large string and
it is making my script very messy.

also, is it possible to have some dynamic parts of the text from the
text file? for example, if i load in a string and there is a part of
it that inserts a value from a variable like the following:

'The number of people is ' + var_people_num;

....so the text from the external file would load but these parts would
be given the value of a variable contained in the script that calls
the external file. its not absolutely crucial that i obtain this but
it would help me seperate large chunks that complicate the script.

View 1 Replies View Related

JQuery :: Loading Html From External File Into Div?

Mar 17, 2011

I'm fairly new to jquery so apologies if this is a very simple question with a very simple answer, but I just can't figure out the solution. I have an overlay div, and when I close the overlay I want to remove the html inside it and then re-load it from the specified file. I have already worked out how to empty the div, but what I now want to do is re-populate it with the content from a separate file on my web server.

[Code]...

View 1 Replies View Related

JQuery :: Refresh A Div Without Loading Any External File?

Sep 6, 2011

I was wondering if how could I refresh a div after a successful ajax execution. My code goes something like this:

$("span.save").live('click', function() {
var id = $(this).attr('id');
var name = $('.ingr_name_' +id).val();
var amount = $('.amt_' +id).val();

[Code].....

View 1 Replies View Related

Loading An XML File (either A Data Island Or External) Into A DOM

Jun 9, 2004

how to load an XML file into a DOM. I can get it done in IE, but in mozilla I am missing something. Here is what my loadXML() function looks like:

function loadXML(){
try {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.onreadystatechange = verify;
hasFile = xmlDoc.load(info.XMLDocument);
if (hasFile){
xmlObj = xmlDoc.documentElement;
allTopics = xmlObj.getElementsByTagName("topic");
}}
catch(e) {
xmlDoc = (new DOMParser()).parseFromString(document.getElementById('info').innerHTML, 'text/xml');
hasFile = true;
allTopics = xmlDoc.getElementsByTagName("topic");

if (hasFile){
allTopics = xmlDoc.getElementsByTagName("topic");
alert(allTopics[0].firstChild.getAttribute("name"));
}}}

Where verify is another function. The try part works for IE, but the catch part doesn't work for Mozilla. I am not finding any information as to really use an XML DOM properly in Mozilla. I'm trying to get allTopics to be a handle on the same thing in both the "try" and the "catch".

View 8 Replies View Related

JQuery :: Loading External Text In To A Text Area?

Sep 7, 2009

<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello, I would like to know if I can load a small text from a external source into a textarea. the external source is a php that will write some clean text depending on the vars received. I know load() can do the job for a div but I don't think it will work for a textarea.
</td></tr></table>

View 2 Replies View Related

Reading External Text File - Load The Content Of The File Into A Variable In Script

Jul 16, 2010

I'm writing a script and I've encountered a problem.. I have a txt file with many words, each word in a different line. For example: the file words.txt contains:

word1
word2
word3
word4
word5

I need to load the content of the file into a variable in my script. I prefer that all the words will be in the same variable with line breaks, but if you'll figure out a way to put it in an array, it's ok too. I really don't know how to do it, and I tried to google but didn't understand.. By the way, I don't want to change the txt file to js file, I need it to remain txt..

View 8 Replies View Related

Parse Text From External File

Oct 9, 2009

I currently have a web applet in straight up Java that allows for a user to interact with a flowchart. I need to convert it to pure Javascript due to technological restrictions on technologies I can use on the school's servers. My original applet parses information from text files that contain information about courses, descriptions, credit hours, etc. I've been googling to see if there is a way to use Javascript to parse these same files for information, but my google-fu is failing me.So my question -- is it possible to, using Javascript, read information out of an external file?

View 1 Replies View Related

JQuery :: Append External Text File To DIV

Apr 21, 2010

I have multiple poems [3 in this trial] (held as external .txt files containing <br> line breaks) that i wish to display at random on each site visit. I don't know how to load them into a specific 'div' area or (if necessary) assign them to a variable.

<script type="text/javascript">
var whichpoem=1+(Math.round(Math.random()*(2)));
var group='/poem'+whichpoem+'.txt';
var client = new XMLHttpRequest();
client.open('GET', group);
client.send();
$.get(group, function(data){
$("body").append(data);
});
</script>

View 2 Replies View Related

Loading Text File To Form In Browser?

Oct 1, 2010

Is it possible to get js to load a txt file in your browser (location would be file:///C:/Documents and Settings/article.txt), grab the first line and put it in a form field with id "postingTitleField"? I've been trying to figure this out but I don't see it. I tried to google it but the best I came up with is writing to a text document, and that's not what I am looking for.

View 4 Replies View Related

Import A Text File - Give The Variable ContentString Its Text From A Hosted Text File In A Similar Manner

Sep 30, 2010

I have some Javascript which says this:

Now that is fine when the text is only one line long. Suppose it's longer? What I want to do is have Javascript give the variable contentString its text from a hosted text file in a similar manner to the way Javascript can insert more Javascript using a hosted .js file.

I illustrate what I need to do using some "dummy" javascript:

View 2 Replies View Related

Including A Javascript External File From The <body> Part Of An HTML File

Sep 26, 2007

I got an [object error] from IE 7.0.5730.11 when moving the <script
src="..." type="text/javascript" /tag from the <headpart to the
<bodysection of a HTML file.

Is not possibile to include Javascript code via <script src="..."
type="text/javascript" /from the <bodysection, instead from the
<headone? If yes, anyone has any idea of which the problem could be?
If not, how can I programmatically include a javascript external file
inside the <bodypart of a HTML file, for example, using Javascript
to some particular native functions?

View 1 Replies View Related

Embedded External - .js File Into HREF Tag - Call The Scripting File Though Html

Oct 15, 2011

I have a external file for example abc.js ,in this abc.js file no functions ,it contains some scripting,i want to call the scripting file though html I use the code

<script type="text/javascript src="abc.js"></script>

in the header file but i want it in a href tag

View 1 Replies View Related

External Txt File - Load The Content Of The File Into A Variable In Script

Jul 16, 2010

I'm writing a script and I've encountered a problem.. I have a txt file with many words, each word in a different line. For example: the file words.txt contains:

word1
word2
word3
word4
word5

I need to load the content of the file into a variable in my script. I prefer that all the words will be in the same variable with line breaks, but if you'll figure out a way to put it in an array, it's ok too. I really don't know how to do it, and I tried to google but didn't understand.. By the way, I don't want to change the txt file to js file, I need it to remain txt..

View 5 Replies View Related

Txt File - Write Information To A Log File That's On An External Site

Feb 26, 2010

Is it possible to use javascript to write information to a log file that's on an external site? What I want to do is have a person put their name and birthday into a form on my site, and then output that information to a partnering site's log file which would be something like www.whatever.com/whatever.file Is this possible? what file type can javascript write to? I put .file because I am unsure.

View 6 Replies View Related

Loading External Age In Tab Containers

Mar 7, 2011

Any suggestion what's the best tab to use in loading external pages(html). Im also thinking of adding multiple subtabs within parent tab.

View 5 Replies View Related

Loading External Html In A DIV?

Oct 15, 2009

Im loading a div of an external html (#right_in) into a div (#right) in my main movie this way:

Code:
var toLoad = divobj.id+'.html #right_in';
function loadContent() {
$('#right').load(toLoad);

[Code]....

Is it possible to specify that the DIV has to load always at y=0, ie from the top?
Because when I load another external div into my main div firefox keeps the latest position (if I scrolled before it loads the new page at that point).

View 1 Replies View Related

Loading File From Disk - Select A File From A List And Load It Into A Webpage

Jan 1, 2011

I am looking for a way to select a file from a list and load it into a webpage. The page and the files are stored on a sd-card for off-line usage, I know that listing files remote dynamicly needs a scripting engine but since the sd-card is on the client side that is not possible, but I can make a list of those files when creating them.

It is intended for a datalogger on a tractor-puller, I create csv files with a bash script on the logger and for off-line viewing I use a javascript charting engine which loads the csv file, the files have the creation date as filename and I can make (and maintain) a list of files when creating them. The plan is that the we can select another data set (run) from within the browser and show that one. I have setup an example at [URL]

View 4 Replies View Related

Syntax Error On External JS File Beyond End Of File

Oct 14, 2005

I have the following HTML file:
---
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="test.js"></script>
</head>
<body>
Hi There. <a href="javascript:doit()">Click Me</a>
</body>
</html>
---

The following js file:
--
function doit() {
alert("I did it");
}
--

Running htm file locally (double click) gives me security warning (XP
SP 2) but if I then select "allow script to run" everything works fine.

But when I serve page through IIS (localhost) I get a syntax error line
4 char 4. Of course there is no line 4 in the js file.

This HAS to be something simple I am missing but I have tried:
- with and without language attribute in script tag
- relative and absolute paths for the js file
- with and without Mime type for js set in IIS

Only remaining thing I guess it could be is file permissions but
everything has execute on it as far as I can see.

View 7 Replies View Related

JQuery :: Loading External Content Into Div?

Nov 12, 2010

I'm trying to load content from an external html file into a div.Here is the code I'm using now:

<script type="text/javascript">
("#upcomingevents").load("upcomingevents.html", function(){
//function executed when load is done.

[code].....

View 1 Replies View Related

JQuery :: Loading External Html In A DIV?

Oct 15, 2009

Im loading a div of an external html (#right_in) into a div (#right) in my main movie this way:

var toLoad = divobj.id+'.html #right_in';
function loadContent() {
$('#right').load(toLoad);
showNewContent();

[Code]....

Is it possible to specify that the DIV has to load always at y=0, ie from the top? Because when I load another external div into my main div firefox keeps the latest position (if I scrolled before it loads the new page at that point).

View 3 Replies View Related

JQuery :: Loading External Html Into A Div?

Jan 30, 2011

I am trying to load a div from one page, into a div on another page. On the webpage I am loading the new div to I put:

[Code]...

Why doesn't this work right? It looks right to me... what am i missing??

View 2 Replies View Related

Loading External Images Within Container?

Dec 22, 2009

I am looking for either a JavaScript or Coldfusion solution to the following problem. First, there are over 60 million product photos so downloading and resizing the photos using Coldfusion would be very tedious.

I would like the display an image within a 100 x 100 pixel container.

If the height or width of the image is great than 100 pixels, the image should reduce in size to fit within the 100 x 100 pixel container.

I want to avoid pixelation of the images as much as possible.

All images are external and not on the local server so I only have an image URL.

I would like to hide all images until they are resized appropriately.

Does anybody know of a piece of javascript code that can do something similar to this?

View 6 Replies View Related

Loading External Swf's Into A Video Player?

May 11, 2009

I have a number off videos that I want to play on a video player that I made using Flash. I can change what video the player plays by changing the filename in the red line in the following code.

Code:
<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',

[Code]....

This player is only going to be used on a local machine and not on the net.

View 2 Replies View Related

Slow Loading W/ External Script

Jan 23, 2004

In my page, I have to load an external javascript (it's an ad serving code, using src='....') and once the external site is not accessible, it slows down my site significantly (to a level that unacceptable to visitors). Is there anything I can do to prevent this? Or anything the ad server needs to change?

View 1 Replies View Related

Loading External Javascript When Site Is Down

Mar 16, 2004

I am working on a client's site and he has some external javascript code that his affiliates can put on their websites to fetch some data. However, when my client's site goes down, the affiliates' sites cease to load thus taking their sites down with it.

Is there any way I can have the javascript check to see if the website is up before loading, and if it is, run this: Code:

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved