Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
include external file in java script var
Old 02-17-2004, 07:16 PM include external file in java script var
Junior Talker

Posts: 1
Trades: 0
My webpage is a .asp file.

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 do.

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-18-2004 at 06:01 PM..
Niko is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-18-2004, 04:04 AM
Ultra Talker

Posts: 377
Trades: 0
Couldn't you just open that file and read the value to your variable? I don't very good in JS (well, not good at all ) but maybe it is possible to do such a thing? For example this can be easy done in PHP...
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Reply     « Reply to include external file in java script var
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09948 seconds with 12 queries