471,852 Members | 831 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

Stop Counter++

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

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 2334
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
Thanx this is what I needed!!!
Mar 29 '07 #3
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.