469,329 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,329 developers. It's quick & easy.

Stop Counter++

8
Hello,
This is my first post and I'm with Javascript a newbie I have this question:

Iím using a function to pass text from a dropdown menu in a textbox, each line that is passes in the textbox should have a number before it, and when the number is reaching 12 it should not be possible to pass any text in the text box. So I was thinking that if i=12 the function should be disabled and the user should get an alert but How can I do this ?

Thanks for any reply
Pete



Var i= 0

oldvalue = "";
function passText(passedvalue) {
if (passedvalue != "") {
var totalvalue = passedvalue+"\n"+oldvalue;
document.displayform.itemsbox.value = (i++) +totalvalue;
oldvalue = document.displayform.itemsbox.value;

}
}
Mar 28 '07 #1
3 2100
acoder
16,027 Expert Mod 8TB
Welcome to TSDN.

At the beginning of your function, add the line:
Expand|Select|Wrap|Line Numbers
  1. if (i == 12) return;
Mar 29 '07 #2
sonner
8
Thanx this is what I needed!!!
Mar 29 '07 #3
acoder
16,027 Expert Mod 8TB
You're welcome.
Mar 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Chua Wen Ching | last post: by
11 posts views Thread by Frank Rizzo | last post: by
1 post views Thread by Brett | last post: by
5 posts views Thread by many_years_after | last post: by
9 posts views Thread by Jon Slaughter | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.