/    Sign up×
Community /Pin to ProfileBookmark

Need help with a script.

I’m trying to create a user navigation system that displays a certain amount of text at a time, hides the rest and recalls more text via user input ( a la back and forward buttons.)

For example, say this is the text:

Blah Blah Blah, Blah Blah
Yadda Yadda Yadda Yadda

“Yadda Yadda Yadda Yadda” is hidden so you would only see the “Blah”s. The user could only see the “Yadda”s if they press the forward button. To return to the “Blah”s they would hit the back button.

I’m having trouble getting the display to work correctly, I’m know I’m doing something wrong.

[CODE]var text=300 //(or any number);
function Display() {
if (!document.getElementById) return;
obj=document.getElementById(“thetext”);
for (i=0, obj.innerText.length < text, i++)
if (obj.innerText.length < text)
obj.style.display.block;
return;
if (obj.innerText.length < text)
obj.style.display.none;
obj + “…”;
}
[/CODE]

I haven’t figured out how to assign the back and foward mechanisms yet.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Lawrence_Fields 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...