Buffer Data 
Author Message
 Buffer Data

I am writing a Java Script. When I press the submit button, I call a
function. In the function, I check that a question has been typed in a text
box and I display a random answer in a marquee along the bottom of the page.

My issue, a user can't ask the same question twice in a row. I can't think
of a way to hold the question for the second time and check that it hasn't
been asked the first time. Can someone give me a clue how I would do that?

Peter




Fri, 27 Aug 2004 03:49:57 GMT  
 Buffer Data

| My issue, a user can't ask the same question twice in a row. I can't think
| of a way to hold the question for the second time and check that it hasn't
| been asked the first time. Can someone give me a clue how I would do that?

It's not really something exceptional, create a variable called "buffer" and
save it after checking with the previous. Like that:

var buffer = '';

function my_form_onsubmit () {
var user_question = YOUR_INPUT_ELEMENT.value;
if (user_question == '') {
alert('Hello-oooo? Are you there?');
return false; // stop and don't submit form

Quote:
};

if (user_question == buffer) {
alert('Ask something else, will ya?');
return false; // stop and don't submit form
Quote:
};

buffer = user_question; // update buffer
// DO STUFF
return false; // don't submit form
Quote:
};



Fri, 27 Aug 2004 07:50:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Unknown token received, Protocol error in TDS stream, TDS buffer length too large

2. Response.Buffer=false - still doesn't work

3. Enlarging LaserWriter frame buffer

4. vbs buffer manipulation

5. Response.buffer in Jscript ?

6. creating keyboard buffer events

7. Postscript compression/"z-buffering"?

8. a2ps and input buffer overflow

9. Buffer On and Off => No Difference

10. how to force IE4 to flush his buffer

11. stop buffer overflow attacks

12. Buffered input

 

 
Powered by phpBB® Forum Software