Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-04-2008, 06:54 AM   PM User | #1
Mikemc
New to the CF scene

 
Join Date: Aug 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mikemc is an unknown quantity at this point
Post Moving field text into existing file.html?

I'm somewhat new to javascript but feel it could be picked up easily. The webpage template my site expects me to fill out is quite messy so I'm aiming to create a front-end for filling it in easier.

I need to learn entering text into a text field, and then having the code place the strings from each field into their proper home within the template. Without going through another "Hello World!" tutorial, what would you suggest I read up on?

- Mike
Mikemc is offline   Reply With Quote
Old 08-04-2008, 08:13 AM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
i think it will prove difficult to modify the html files itself. if you could dump your template changes into a plain text file like json, you could serve the template and apply the template on either the server or the client using javascript. finding locations in html files is tricky at best, and often inconsistant and unpredictable when unknown user content is inserted.

a compromise would be to build templates, render them yourself in the browser, and save/serve the resulting html files.

i have a post in the codebank, "post a javascript", called loading and saving files than will show you the most basic example of what you want to do. perhaps you could modify it to suit your needs.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%

Last edited by rnd me; 08-04-2008 at 08:19 AM..
rnd me is offline   Reply With Quote
Old 08-04-2008, 08:44 AM   PM User | #3
Mikemc
New to the CF scene

 
Join Date: Aug 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mikemc is an unknown quantity at this point
Hmm.. A little over my head but I checked the file out anyways. I don't understand what needs to be in 'newPage.htm' to recieve and print the new text.

I recall I've seen a way to output temporarly to the window for copy-paste. If I could get it to simply display all the finished html, that would still be a big help.

Thanks for your reply too .
Mikemc is offline   Reply With Quote
Old 08-04-2008, 11:12 AM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by Mikemc View Post
Hmm.. A little over my head but I checked the file out anyways. I don't understand what needs to be in 'newPage.htm' to recieve and print the new text.

I recall I've seen a way to output temporarly to the window for copy-paste. If I could get it to simply display all the finished html, that would still be a big help.

Thanks for your reply too .
nothing needs to be in the newpage file, it is written with the test in the text box. in hindsight it would be better to have named the example newpage.txt instead....

im ot sure exactly what kind of setup you are using, and what you looking to do with javascript.

in firefox you can highlight a selection and right-click "view selection source" to see the updated code. you can click on the page;s bacground first, and then press <CTRL>+<A> to select all, then repeat the right-click v.s.s. thing to get a view of the whole, current page.


if you are looking to bypass the template maker and dump html files, you could grab a rendered page using the above method for ajaxified pages, of the save page as for regular pages, and save it as a text file.

you would then edit the html and replace the template areas with identifiers. i like "**title**" style placeholders, but you can use anything.
javascript could then read in the file and replace **title** with textbox1.value for instance. the result could be saved or displayed in a textbox to paste and save.


if you could describe your situation/goals in a little more detail, i can likely be a lot more useful.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 08-05-2008, 08:37 AM   PM User | #5
Mikemc
New to the CF scene

 
Join Date: Aug 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mikemc is an unknown quantity at this point
Thanks loads for your assistance! I've asked in 3 forums and this one has already steered me in the right direction . The template is for a videogame music site. I am one of the people who creates a page that lists game information and each track name and length. However instead of a simple "Open in your favorite webpage editor", the manager has given me a huge walkthrough on where in the code I have to place everything.

So what I would like to do is to use text fields to enter in the necessary information, and then simply press 'Submit' and have the code place it all into it's proper places.

Currently I'm looking into having the webpage code printed in a new window and telling the user to copy-paste the whole thing into notepad and save it as an .htm file. I believe the 'document.game_title.value' thing will be part of it.

And I have no idea what Ajax code is.

- Mike
Mikemc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:29 AM.


Advertisement
Log in to turn off these ads.