/    Sign up×
Community /Pin to ProfileBookmark

Growing html with clicks

I want to include a button for growing an html-based website. For instance, every time a button ‘grow!’ is pressed, an extra ‘Hello world!’ string is displayed (e.g., added as <p>Hello world!</p>).

Suggestions/Sample code welcome,
Ruben

PS: Since I hesitated on what the most appropriate place for this is, I have posted twice, at JS and PHP forums.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@cconn64Apr 02.2008 — [CODE]<html>
<script language="javascript">
function addIt(txt) {
document.getElementById('Output').innerHTML = document.getElementById('Output').innerHTML + txt + "<br />";
}
</script>
<body>
<div id="Output"></div>
<form action="#">
<input type="button" value="Add 1 More" onclick="addIt('Hello World');">
</form>
</body>
</html>[/CODE]


Sorry, I didn't use the output as "<p>Hellow World!</p>". ?
Copy linkTweet thisAlerts:
@rvazquezauthorApr 02.2008 — Great answer ?

1 + question: how can I adapt the following line to modify the content of a frame rather than the current html?

'document.getElementById('Output').innerHTML = document.getElementById('Output').innerHTML + txt + "<br />";'

Perhaps something like: parent.bottom.getElementById...

I tried this, but it doesn't work...

Thanks,

Ruben
×

Success!

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