displaying text for a set amount of time

This is a discussion on "displaying text for a set amount of time" within the JavaScript Forum section. This forum, and the thread "displaying text for a set amount of time are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 5th, 2008, 11:04
New Member
Join Date: Feb 2008
Location: bristol
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
displaying text for a set amount of time

Hi

I have been trying to find an example via google but can not see any links to my problem so am trying here!

I have function to strip out any char inputs on a form . I am trying to get it to to display a error message that chars are not alllowed.

I am using the .innerHTMl on a bold tag next to below the form dispaly an error mesage once a non-char is inputted.

It shows when a char is inputted but I wantt it to display only for a set amount of time. At the moment it just stays there intill the page is re-freshed. Any help on how to do it would be great!


Code-

function validNumeric(f) {

if (!/^\d*$/.test(f.value)) {
document.getElementById('error').innerHTML = 'Please Only enter letters';
f.value = f.value.replace(/[^\d]/g,"");
}

}
Reply With Quote

  #2 (permalink)  
Old Feb 5th, 2008, 13:39
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: displaying text for a set amount of time

You can use this

Code: Select all
var numberOfSeconds = 6;
function clearOutBoldTag()
{
     document.getElementById('error').innerHTML = '';
}

function validNumeric(f) {

if (!/^\d*$/.test(f.value)) {
document.getElementById('error').innerHTML = 'Please Only enter letters';
f.value = f.value.replace(/[^\d]/g,"");

// set the timeout to clear the text

window.setTimeout('clearOutBoldTag()', numberOfSeconds*1000);
}

}
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
making text field text disapear Phixon JavaScript Forum 4 Feb 2nd, 2008 07:49
[SOLVED] why isnt my javascript displaying the text skat JavaScript Forum 3 Jan 26th, 2008 20:43
[SOLVED] Are there limits on the amount of data that can be posted via an ASP Form? Phil Classic ASP 5 Oct 26th, 2007 08:43
Approve the Amount accessman Databases 1 Sep 24th, 2005 06:52
Adjusting time from server time to local time Tim356 Classic ASP 10 Jun 21st, 2004 14:57


All times are GMT. The time now is 11:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43