/    Sign up×
Community /Pin to ProfileBookmark

put text in different frame/form field

I have this code to place a smilie code in to a different form in a different frame… but it does not work. Please help!

[CODE]<script language=”JavaScript” type=”text/javascript”>

function emoticon(text) {
text = ‘ ‘ + text + ‘ ‘;
if (parent.frame2.post.M.createTextRange && parent.frame2.post.M.caretPos) {
var caretPos = parent.frame2.post.M.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length – 1) == ‘ ‘ ? text + ‘ ‘ : text;
parent.frame2.post.M.focus();
} else {
parent.frame2.post.M.value += text;
parent.frame2.post.M.focus();
}
}

</script>[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@HaganeNoKokoroAug 09.2004 — Your code looks like it just adds the contents of the 'text' variable to the 'M' input of form 'post' (weird name for a form, considering it is also an option for the method attribute of the form) I tried your code with a page and frameset I made up and it seemed to work (that is, I clicked on a button to call the function 'emoticon' and it added to the value of the input in frame2) so I'm not quite sure what the problem is... What exactly is it supposed to be doing that it's not?
×

Success!

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