Oh great!!! how do i get this working for my website?

Calling an external script should work... but it doesn/t

I'm trying to avoid php scripting and MySql for now and one way to organize text stories is to have them externally linked to somewhere else. That way I can just wrtie the story, then change it when I want to.

I am using the ducument.write i a text file and linking the text file to the spot on the page

script language = javascript text = "text/javastipt" src = "externalscript.txt"

But it won't work!!!

The file is in the same directory as the html file its suppossed to write on... ooooohhh what a world!!!!

any help on this?
(By the way, it suppossed to work on all browsers)
2,793 views 14 replies
Reply #1 Top
I'm lost, perhaps an example of what you want?

I'm thinking a simple iFrame might do what you're looking for. o.o
Reply #2 Top
Um, you using a CMS of any kind...?
Reply #3 Top
Well, its javascript, not CSS.

This is what is suppossed to happen.

I have a javascript on another page. That javascript I call externaljavascript. All it does is put text on a webpage.
EX:
document . write (" This is just the beginning! ")
Without the spaces of course.

I save that as a txt file and place it on the server within the same folder as the html page it is suppossed to write on

Now on the webpage it is suppossed to write on... well it won't.

In the body of the webpage I put:

< SCRIPT LANGUAGE = " Javascript " TYPE=" text/javascript " scr = " gamessection2.txt">

< /SCRIPT >
(again, without the spaces)


In the book, it says it is suppossed to import the javascript and run it. When it runs, its suppossed to write the text:
This is just the beginning!


So far so bad... It must be something... a quote, a line something I am missing that I am just not seeing.


Also:
I don't know css as well as I would like (which is slowing me down in making a FireFox skin too) but I think I could do this with a div tage, but I am not sure. I think I can have a div tage 'write' something on the html document.

Basically what I am trying to do is set up my website so it is easier to edit text stories with out making a dynamic database. I write a story in a text file and the javascript calles it and puts it on the page. I can change content from one source.




Man... I really need to learn this building a website stuff faster! Eventually I will have to learn php amd MySQL.
Reply #4 Top
arg...
I spelled 'src' as 'scr'

That is why it wouldn't work.

Now it works but I can't just type like I want to. I want to be able to just type and the webpage externally link to what I types in the text file.

Anyway, I finally came up with the word combination on Google to get me what I want


http://www.webmasterworld.com/forum21/6602.htm

The only problem will be is if the person has javascript off then they won't see anything!!!

I also found some other solutions too. I could turn the html to php and have a php include. I think that would work. The only thing is that I have to upload it to test it. php doesn't work on my computer so I can't render the webpages until its on the server.

You even felt like your just spinning your wheels and gong nowhere fast?
Reply #5 Top
BTW: If you need a speedy response on more advanced web coding/etc head over to Sitepoint.com
I always get a quick response there.
Reply #6 Top
Thanks for the help you guy! And thanks for the url to SitePoint. Cool site.
Reply #7 Top
Well.. I didn't really answer any of your questions. I figure most at that site are more qualified than myself. heh..
Reply #8 Top

Does your server run php? If so, couldn't you just use an include statement

  • < ? include "externalfile.txt" ; ? >

Or, maybe I'm misunderstanding what you're wanting?

I realize this involves php scripting, but it does avoid the javascript issue with browsers, and doesn't involve mysql or anthing to heavy php-wise.

Reply #9 Top
Yeah, It does run PHP and I actually got the answer I wanted by visiting Site Point and other sites like javascript.internet.com

You can, of course, have a include for javascript from somehwere else on the net, but the problem is that commas in whate ever you want the Javascript to write on the HTML page can be a problem.

There is a way around that by using the \" but can get complex when you have allot of code to place.


In he end, I am going to use the php included statement. The only problem for me is that I have to upload it to the server to see how it looks on the webpage (for my system is not linux).


At anyrate, this will make it easier to organize stories and active them as well.
I am really excited about this!!! I couldn't sleep because I was so excited. Really.
Reply #10 Top
This is just my curiousity kicking in here, but why can't you test it on your machine?
Reply #11 Top
It doesn't run php extention. so test.htm will run but test.php won't
I have XP Home.
Reply #12 Top
Gotcha. Have you checked out this for a personal web server on XP Home? (Link)

I honestly haven't tried it as I run XP Pro, but it might be worth a shot.
Reply #13 Top
Cool. I will see what it does for me.
Reply #14 Top
Just install any web server such as Apache (http://httpd.apache.org/download.cgi) and then install the PHP server (http://ca3.php.net/get/php-4.3.10-installer.exe/from/a/mirror) and you'll be all set.