Reply
A little help with button please
Old 11-17-2006, 08:22 PM A little help with button please
Experienced Talker

Posts: 31
Name: Paul
I want to make this:
When page loads there will be a button, but I want for it to be disabled (can't click it) for specified time.

For example when page loads I want the button to look like this:
"Submit (10)" after 1 second - "Submit (9)" and so on....
when the timer reaches 0, the button would be enabled, so now you can click it, it will work and redirect you to any specified location.

Thank you for help
Athlon1600 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-17-2006, 09:10 PM Re: A little help with button please
Average Talker

Posts: 18
Quote:
Originally Posted by Athlon1600 View Post
I want to make this:
When page loads there will be a button, but I want for it to be disabled (can't click it) for specified time.

For example when page loads I want the button to look like this:
"Submit (10)" after 1 second - "Submit (9)" and so on....
when the timer reaches 0, the button would be enabled, so now you can click it, it will work and redirect you to any specified location.

Thank you for help
Maybe create a timer and then make a fuction like this:
Code:
function onclick_checktimer() {
    if (timer < 10) {
        return false;
    }
    else {
        return true;
    }
}
Then in your button you need to do like so:

HTML Code:
<input type='submit' name='Whatever your name was' onclick='return onclick_checktimer()'>
__________________
Relevancy is key. Get the most out of your keywords! - http://www.olcore.com
olcore is offline
Reply With Quote
View Public Profile Visit olcore's homepage!
 
Old 11-17-2006, 09:29 PM Re: A little help with button please
Experienced Talker

Posts: 31
Name: Paul
I did this:
In the <head> section I put this:

<script language="JavaScript" type="text/javascript">
function onclick_checktimer() {
if (timer < 10) {
return false;
}
else {
return true;
}
}
</script>

For the button section:

"Whatever your name was" ???? what name?
I just put by default 'submit' name. Still isn't working, in the status bar it says - 'error on the page'

----------------------------------
by the script source I understood that this script is not disabling button.
I want so that the button at first (when page loads) would be disabled (can't click at all)
And text on it changes, second by second (real-time) - 'submit (10)' - 'submit (9)' - 'submit (8)'............. When it reaches zero (just 'submit' text) the button should be enabled - you can click it now.

I saw this on someones website, it was something like protection against those who just skipped rules page, the buttons time delay was like 20 seconds so that everybody would read rules in 20 seconds and not just skip it because button was disabled for 20 seconds.

Thanks for help anyways.
Waiting for more replies...
Athlon1600 is offline
Reply With Quote
View Public Profile
 
Old 11-18-2006, 01:36 AM Re: A little help with button please
Novice Talker

Posts: 9
Location: Russian Federation
Athlon1600, look at this:
javascript
Code:
 
function init() {
  var o = document.getElementById('test');
  o.count_down = 10000;
  count(o);
}
function count(o) {
  if(o.count_down) {
    o.count_down -= 1000;
    o.value = 'submit('+o.count_down/1000+')';
    window.setTimeout(function() {
      count(o); }, 1000);
  }
  else {
    o.value = 'submit';
    o.disabled = false;
  }
}
onload = init;
(x)html
HTML Code:
<input type='submit' id='test' disabled='disabled' value='submit(10)' />
_ru_ is offline
Reply With Quote
View Public Profile
 
Old 11-18-2006, 09:53 AM Re: A little help with button please
Experienced Talker

Posts: 31
Name: Paul
That was exactly what I was looking for
Thank you very much!
Athlon1600 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to A little help with button please
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12794 seconds with 12 queries