/    Sign up×
Community /Pin to ProfileBookmark

Including values from a text file

I’ve got a problem where I need a simple text file that a user can change two simple values and those values are then called by two hidden input fields in an html file.

I can’t seem to get anything that works. Can you help?

Thanks
Jon

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@felgallOct 06.2005 — For Javascript to be able to read a file that file must contain Javascript and be referenced as such.
Copy linkTweet thisAlerts:
@jonwinterauthorOct 07.2005 — How would you use javascript in the text file but keeping it really simple so a user can edit two values i.e. var limit = 1000; var currentlevel = 900;

I guessing a bit here but can you show a working example if this is correct idea?
Copy linkTweet thisAlerts:
@CharlesOct 07.2005 — includeFile.js:limit = 1000
currentLevel=100
And to call it:<script src="includeFile.js" type="text/javascript"></script>
<script type="text/javascript">
alert ([limit, currentLevel])
</script>
Copy linkTweet thisAlerts:
@jonwinterauthorOct 07.2005 — Thanks for that. I managed to change the include file to a text file instead of a .js file (users can double click it and edit it in notepad) and just used var limit = 1000; var currentLevel = 100. These values were then called in the html page and written into two hidden input fields. From there everything is now working as I hoped!

Thanks for your guidance and support as I hadn't realised it was so easy to do this! Keep up the good work guys ?)
×

Success!

Help @jonwinter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...