473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to read a file into an html doc (client side)?

beacon
579 512MB
Hi everybody,

This may end up being more of a javascript question, but I'm going to start here since I'm fairly inexperienced creating web pages AND because I'm limited to only creating client-side web pages at work (no web server...no budget for web server).

Here's the gist of it all: I've created a basic client-side website (if you want to call it a website) where I've created multiple HTML documents and linked them together. I've got a CSS file that provides pretty much all the formatting for every page.

One of the pages I have is for FAQs. Over the past couple of years I've just added individual questions to the top part of the page and the answers to those questions at the bottom of the page...pretty typical FAQ layout. The questions are hyperlinks to the bookmarked answers, and the answers have a bookmark to "Return to top" so the user can browse through the questions again.

We recently began a new process that will require a number of new FAQs to be written and put in the page. However, another department, with no programming skills, will be providing the FAQs. In an effort to remove myself entirely from the process, I was trying to find a way that I could have the other department enter their questions in one file (maybe as a numbered list) and their answers in another. Then, find a way to import the questions/answers into the page when the page is loaded. I would prefer not to use iFrames for this and would prefer to have the text appear, and allow the existing CSS formatting to apply to the text, the same as it currently does.

Is this possible? Is this the right forum for my question?

Thanks,
beacon
May 29 '11 #1
7 2437
drhowarddrfine
7,435 Expert 4TB
You're right, neither HTML or CSS can do this.
May 30 '11 #2
beacon
579 512MB
So doc, do you have any alternatives I can try out, our should I pack my things and jump to another forum?
May 31 '11 #3
drhowarddrfine
7,435 Expert 4TB
You answered your own question. Javascript might do this or any other programming language.

As far as the cost of web servers go, most of them are free and run on any old hardware you have lying around, so having an internal web site should not be holding you back.
May 31 '11 #4
Niheel
2,460 Expert Mod 2GB
Store the files in XML or JSON text and then use javascript in the browser to parse the files.

http://json.org/example.html
Ths link will show you how JSON and XML files can be used to store data

Then what you want to do is parse these files with javascript.

json in javascript:
http://www.json.org/js.html

Either way, you'll have to store those data files somewhere, like on a webserver unless you're packaging them to be used locally.
May 31 '11 #5
beacon
579 512MB
Hi Niheel,

I'm confused by your response...not that it's not a good response, I'm just not as well-versed in all things inter-web.

Are you saying that I could create a text file with all 'FAQ' questions, numbered one to 50, close/save it, then use JSON to reference the file and Javascript to parse the file and display it in my HTML doc? If that's what you're saying, I didn't see how to do that in the link you provided.

If that's not what you're saying, and what you're telling me is that I will have to take each of those 50 'FAQ' questions and put them in a JSON array, that's not really what I'm looking for. Is there no way to setup just a plain text file or Word document and read in the contents to the HTML doc?

I'm somewhat familiar with JSON, but the users won't be and I guarantee you they won't be willing to learn. The best I can hope for from them is a numbered text file or Word doc.

I'm limited entirely to the client-side for programming and storing the documents. Plus, there's my selfish desire to create something that other users can update so I never have to think about it again. =)

Sorry to be difficult and thanks for your help,
beacon
May 31 '11 #6
Niheel
2,460 Expert Mod 2GB
Basically, store your data in XML files or Text files. Then use javascript to parse the data and display it in the htmls files you want.

Since you want it to be updated by folks using word docs etc, why not use something like .NET to take word documents and then turn them into XML files that you can parse and display as you wish.

How are you distributing these help files? Is it on one machine and everyone uses that machine? Do you send out update packages? or Are you storing the files on the web so that anyone can access them(from your prior response i take this is a no)?
May 31 '11 #7
beacon
579 512MB
I'm going to try to answer your questions as best I can without completely revealing myself as someone who really has no idea what he's doing...doh!

XML files
Don't these require formatting to be applied? Or can the users just save a Word document (we use 2003) with a .xml extension? Will any formatting that's been applied in the Word doc carry over to the XML and ultimately change the web page?

Text files
Would you recommend any particular layout to make this work? Would a numbered list be okay so long as the numbering is consistent (i.e. "1" vs. "1." vs. "1)")?

Parsing using Javascript
This is where I show my true colors...parsing would be where I would analyze a group of characters/delimiters to determine where to start/stop reading in the file, right? Do you know of any good sites where I can learn how to do this? Unfortunately, my Javascript ability consists of searching on the web, copying/pasting, and hoping it works.

.NET
I don't have .NET and can't get .NET. It's a shame too. Just to put things into perspective so you can see how much I'm having to make out of so little, everything that I've done so far with this "website" has been done in Notepad. Not Notepad++...just Notepad. And I put "website" in quotations because I don't really think of it as a website in the traditional sense. I have a folder on a public network drive that has a bunch of HTML docs in it...that's the extent of the website.

Distribution
Currently, the content for the FAQs are hard coded into the HTML with the formatting applied (there's an external CSS file in the parent folder with the main HTML page). Since I've historically been the only one adding or removing items from the "website, I've just added/removed blocks of HTML as needed. I wouldn't say that I send out update packages...I just write, re-write, or overwrite the HTML files, using Notepad, then save it. As I mentioned in the last section, the "website" is basically just a bunch of HTML docs on a public network drive. Everyone can access the folder on the network, so opening any of the HTML docs is essentially the same as opening a Word document or Excel spreadsheet on a network. I like to think of this as an Extra-Intranet site since there's no web server.

Thanks for being patient with me.
May 31 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Savas Ates | last post by:
how can i copy i file from server to client side ... any solution or can it be?
1
by: Craig Conly | last post by:
I was able on an XP machine to use an HTML button with the following client-side javascript: onclick="window.navigate('/xxxxxx.cub')" that would allow the client to either save the file or open...
3
by: Paul | last post by:
Is it possible to delete a file on a client side machine using VB/JAVA script? My website allows the user to upload a file to the website and after that I would like to delete the file on their...
26
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via...
2
by: mhadi | last post by:
Hello Please Help me!! The big bossman is screaming in my ear, I am only devloper of dotnet in my software house and know only to develop widows based application !! My boss wan't me to...
1
by: GDURAN | last post by:
How can create a file at client-side? I need verify (find, create and delete) a temp file at client side. How search a path(file) in differents OS (mac, windows)
6
by: viki | last post by:
Hi, I want to run the batch file from the client side. I was able to do it in the server side by using process. But i want to run from the client side , like we do in asp using...
4
by: ramadeviirrigireddy | last post by:
Hi can anyone tell me how to find the size of an uploaded file on client side this should be done without using ActiveX controls
5
by: ramadeviirrigireddy | last post by:
Hi can anyone tell me how to find the size of an uploaded file on client side this should be done without using ActiveX controls
2
AnuSumesh
by: AnuSumesh | last post by:
Hi I m new to ASP 'n' this forum also. I m writing one code to invoke remote desktop service for given IP address. For that i m using mstsc.exe file to invoke RDP. I have a no of links to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.