/    Sign up×
Community /Pin to ProfileBookmark

what is simplest way to display revised data?

Ok, my first thread?

Having worked extensively with C++, VB, and PHP, I am now trying to figure out the quirks of JavaScript, too. My current dilemma is trying to understand how I can best update and refresh displayed text on a JavaScript generated window.

Here is what I want to do – Display a small pop-up window that shows a grammatically correct sentence in a foreign language. The user can click on a button on the window for another example of the particular grammar topic, and the window would refresh and display another example. So bascially there would be a text field, a “Gimme Another” button, and a “Close” button.

I already have completed the code (in VB, need to port to JavaScript) for all of the grammar calculations, so that part is basically done. What I DON’T want to do is do the grammar calcs server side (via PHP) because they are intensive and don’t want the load on my server and the bandwidth usage every time the user clicks “Gimme Another”.

When I try to print to the same window (via document.writeln) with updated HTML, naturally the script only works once. Do I need to use frames and two separate HTML files, one for the display and one for the main JavaScript code?

Any ideas/suggestions would be greatly appreciated.

Thanks!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriFeb 12.2004 — hi welcome to the forums

make a <div> say <div align="center" id="gimme">Sentence</div>

<input type="button" value="Another" onclick="document.getElementById('gimme').innerHTML='WOTEVA';">
Copy linkTweet thisAlerts:
@misterheadacheauthorFeb 12.2004 — Holy cow is that easy? Thanks!

It is also interesting that neither the getElementByID() method nor the innerHTML property are even mentioned in the official JavaScript Guide or the JavaScript Reference documents. Probably because they technically are DHTML items and not JavaScript?
Copy linkTweet thisAlerts:
@96turnerriFeb 12.2004 — what references are you using?
Copy linkTweet thisAlerts:
@misterheadacheauthorFeb 12.2004 — They are "Client-Side Java Script Guide version 1.3" as file 816-6409-10.pdf and "Client-Side Java Reference version 1.3" as file 816-6408-10.pdf. I downloaded them from [URL]http://docs.sun.com[/URL]
Copy linkTweet thisAlerts:
@96turnerriFeb 12.2004 — 1.5 is the latest version thats probably y getElementById(" "); isnt there
×

Success!

Help @misterheadache 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.26,
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,
)...