/    Sign up×
Community /Pin to ProfileBookmark

Sorry for the cryptic title. no idea what to call it

I just edited a great script I found on your forum that works great for what I need, It adds the text of a DIV to a Textbox when you click on the div, I have edited it to do the same from one textbox to another when you click a button. I just want to know If I can make it so when you click the button and it adds the notes, it also adds a ascending number.

Script:

[CODE]
<html>
<head>

<title>Logger</title>

<script type=”text/javascript”>
function CopyDIV(IDS) {
document.getElementById(‘CopiedDIV’).value
+= ‘=============================n’ + document.getElementById(IDS).innerHTML + ‘nn’;
}
</script>

</head>

<body>

<input type=”button” value=”Store in Notes” onClick=”CopyDIV(textb1.id)”>
<br>
<textarea type=”text” id=”textb1″ value=”sup g” cols=”60″ rows=”8″></textarea>

<br><br>

Notes:
<br>
<textarea type=”text” id=”CopiedDIV” value=”” cols=”60″ rows=”10″></textarea>

</body>

</html>
[/CODE]

so input
hello world

output
====================

text 1.
hello World

and second click output
====================

text 2.
hello World

and so on. somthing that would invole adding like + ‘i+1’ + but i have no idea how to do this.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 20.2008 — <i>
</i>&lt;script type="text/javascript"&gt;
var i = 0;
function CopyDIV(IDS) {
document.getElementById('CopiedDIV').value
+= '====================n' + 'text '+(i++)+'n'+document.getElementById(IDS).innerHTML + 'nn';
}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@KirtanglauthorJun 20.2008 — And I thank you sir, that was a quick responce aswell thanx

Worked a treat, i knew it was easy, but i know little about code.

Kirt
×

Success!

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