Jump to content

javascript alert help :)

Zuccers
Go to solution Solved by ArjhanToteck,
On 5/14/2019 at 9:34 AM, Duckster said:

my friend can help you. ill get him soon/later

 

I'm the friend Duckster was talking about. What you should do is assign a blank variable to the textbox where the characters are being typed. Then you can make another variable and assign the length of the first variable to the second variable. For example,

let text

let characters

Then you should add a variable called var1 and then make a loop that sets the value of characters to the length of text as long as var1 = 0, and within it an if statement that tests the amount of characters and alerts the user if there are more than 750 characters.

var var1 = 0
while(chracters < 751){
	characters = text.length
	if(characters === 750|| characters > 750){
		overMax()
	}
}

function overMax(){
	\\ add alert lines here.
}

Depending on what you're file or application is, you can add the alert in the \\add alert lines here spot. This might work as the alert function;

function overMax(){
	alert("You have 750 characters. You might want to save now to prevent losing some work in case of the program crashing.")
}

 

Hello, i'm turning to LTT's programmers once again, today my plan was to update my "program" and i came to an idea: if there are 750 characters, that it would alert you, to save a version of the text, so you wouldn't loose much ? (if it crashed, because that can happen), but as i don't really work with javascript, i really need help, can anyone help to find or write this function?

Thanks in advance
Zuccers ?

Link to comment
Share on other sites

Link to post
Share on other sites

30 minutes ago, Zuccers said:

Hello, i'm turning to LTT's programmers once again, today my plan was to update my "program" and i came to an idea: if there are 750 characters, that it would alert you, to save a version of the text, so you wouldn't loose much ? (if it crashed, because that can happen), but as i don't really work with javascript, i really need help, can anyone help to find or write this function?

Thanks in advance
Zuccers ?

my friend can help you. ill get him soon/later

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Duckster said:

What is your question?

 

I need a function, that warns the user if the text is over 750 characters to download...

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

On 5/14/2019 at 9:34 AM, Duckster said:

my friend can help you. ill get him soon/later

 

I'm the friend Duckster was talking about. What you should do is assign a blank variable to the textbox where the characters are being typed. Then you can make another variable and assign the length of the first variable to the second variable. For example,

let text

let characters

Then you should add a variable called var1 and then make a loop that sets the value of characters to the length of text as long as var1 = 0, and within it an if statement that tests the amount of characters and alerts the user if there are more than 750 characters.

var var1 = 0
while(chracters < 751){
	characters = text.length
	if(characters === 750|| characters > 750){
		overMax()
	}
}

function overMax(){
	\\ add alert lines here.
}

Depending on what you're file or application is, you can add the alert in the \\add alert lines here spot. This might work as the alert function;

function overMax(){
	alert("You have 750 characters. You might want to save now to prevent losing some work in case of the program crashing.")
}

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×