NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Web Design Discussion
Reload this Page include external file in java script var

Web Design Discussion Discussion of web design techniques, advice, browser issues, software, design firms.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-17-2004, 03:37 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Feb 2004
Posts: 3
Niko is an unknown quantity at this point
 



Question include external file in java script var


My webpage is a .asp file.
????: NamePros.com http://www.namepros.com/web-design-discussion/20943-include-external-file-java-script-var.html

Is it possible to read a value from external file and store it in a javascript var.


The external file only contains a price (digits and a decimal point).

The filename is price1.asp but can be .txt, .inc, .whatever....

var price1=(199.95);

I want to put the price 199.95 into the external file price1.asp.

This doesn't work, but will help you understand what I want to achieve.

var price1=(<!--#include file="include/price1.asp"-->);



This is no good either, because I can't store the value in the javascript variable.


<%
Set fs = CreateObject("Scripting.FileSystemObject")

Set wfile = fs.OpenTextFile("d:/test.txt")
price1 = wfile.ReadLine

wfile.close
Set wfile=nothing
Set fs=nothing

%>


// This showed the correct value

<%
response.write (price1)
%>

I don't know database, is there another way.
Last edited by Niko; 02-20-2004 at 06:26 PM.
Niko is offline  
Old 02-17-2004, 04:44 PM   #2 (permalink)
NamePros Regular
Join Date: Dec 2003
Location: Secaucus, NJ
Posts: 597
x3knet has a spectacular aura aboutx3knet has a spectacular aura about
 



Isn't (<!--#include file="include/price1.asp"--> ); CGI???
__________________
http://www.BaseballExposure.com
Your Free Source to College Baseball Recruiting Information
FOR SALE: BaseballRecruiting.info | BaseballSwing.info | BaseballCoaches.info
x3knet is offline  
Old 02-17-2004, 07:03 PM   #3 (permalink)
Senior Member
Join Date: Aug 2002
Posts: 1,255
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
 



Re: include external file in java script var


Quote:
Originally posted by Niko
How do I include an external file called price1.asp into a java script variable.

var price1=(199.95);

I want to put the price 199.95 into a external file called price1.asp.

I've tried this but it doesn't work
var price1=(<!--#include file="include/price1.asp"-->);

I'd rather not use a database thanks.
Are you trying to include this price1.asp file in another .asp file? All you should really need to do if so is save the text 199.95 in the price1.asp file and then use the include directive to include it where you want on the other page.
????: NamePros.com http://www.namepros.com/showthread.php?t=20943

There's no way to include external files with JavaScript alone, or at least not that I know of. Anyways if you can be a little more specific that would help.

Quote:
Originally posted by x3knet
Isn't (<!--#include file="include/price1.asp"--> ); CGI???
Nope, it's Server Side Includes.
deadserious is offline  
Old 02-17-2004, 09:49 PM   #4 (permalink)
NamePros Regular
Join Date: Dec 2003
Location: Secaucus, NJ
Posts: 597
x3knet has a spectacular aura aboutx3knet has a spectacular aura about
 



Yeah, that's what I meant, lol. CGI is along the same lines as SSI.
__________________
http://www.BaseballExposure.com
Your Free Source to College Baseball Recruiting Information
FOR SALE: BaseballRecruiting.info | BaseballSwing.info | BaseballCoaches.info
x3knet is offline  
Old 02-20-2004, 02:41 AM   #5 (permalink)
NamePros Expert
 
Anthony's Avatar
Join Date: Dec 2003
Location: NYC
Posts: 9,134
Anthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant future
 

Member of the Month
October 2004

Ah, good 'ole SSIs. I still prefer PHP includes myself.
Anthony is offline  
Old 02-22-2004, 04:48 PM THREAD STARTER               #6 (permalink)
New Member
Join Date: Feb 2004
Posts: 3
Niko is an unknown quantity at this point
 



These forums are a waste of time,
People ask for help,
and all we get is smart arse comments!
Niko is offline  
Old 02-22-2004, 04:56 PM   #7 (permalink)
NamePros Expert
 
Tippy's Avatar
Join Date: May 2003
Location: Montreal
Posts: 7,019
Tippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond reputeTippy has a reputation beyond repute
 



So, after one post you came to that conclusion?

Mike
Tippy is offline  
Old 02-26-2004, 07:21 PM THREAD STARTER               #8 (permalink)
New Member
Join Date: Feb 2004
Posts: 3
Niko is an unknown quantity at this point
 



Quote:
Originally posted by Tippy
So, after one post you came to that conclusion?

Mike
No,
after 4 useless replys,
you just made it 5
Niko is offline  
Old 02-27-2004, 12:23 AM   #9 (permalink)
Senior Member
Join Date: Aug 2002
Posts: 1,255
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
 



Quote:
Originally posted by Niko
No,
after 4 useless replys,
you just made it 5
You're the one that is making the useless replies. If you can't appreciate people trying to help and answer questions when you're asked to clarify or explain yourself in more detail and be polite then don't post.
deadserious is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 10:09 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger