How Reddit Clears Its Searchbox
Mar 2, 2010
When you load [url] the searchbox contains the words "search reddit". Once it receives the focus by tabbing or clicking, the contents are cleared. However, there is no onfocus event, onclick event or any other script within the tag for this textbox. How is a textbox cleared without explicitly using an event?
View 2 Replies
Mar 2, 2010
When you load [URL] the searchbox contains the words "search reddit". Once it receives the focus by tabbing or clicking, the contents are cleared. However, there is no onfocus event, onclick event or any other script within the tag for this textbox. How is a textbox cleared without explicitly using an event?
View 2 Replies
View Related
Jan 12, 2009
I have 5 radio buttons and 1 text field. 4 radio buttons have different money value and the text field is a fill in. I am wanting to clear and disable the text field and its radio button when a different radio button is chosen. Here is the code I am using.
[Code]...
View 2 Replies
View Related
Feb 15, 2010
Wondering if someone could help me out. i am developing a simple javascript calculator at the problem is this:When I use the input type = button or submit, then the calculator works fineBUTI need to use a custom button and now the calculator just shows the results for a split second and then disappears and the form reloadsHere is my code:
<html>
<head>
<script language="JavaScript">
[code]....
View 13 Replies
View Related
Aug 31, 2011
I am having a dickens of a time figuring out how to add an event handler that clears my text fields when the clear button is clicked. This is the code that I've done but to no avail.
var $ = function (id) {
return document.getElementById(id);}
var calculate_click = function () {
var investment = parseFloat( $("investment").value );
var annualRate = parseFloat( $("rate").value );
var years = parseInt( $("years").value );
$("futureValue").value = "";
if (isNaN(investment) || investment <= 0) {
alert("Investment must be a valid number\nand greater than zero.");
} else if(isNaN(annualRate) || annualRate > 20) {
alert("Annual rate must be a valid number\nand less than or equal to 20.");
} else if(isNaN(years) || years > 50) {
alert("Years must be a valid number\nand less than or equal to 50.");
} else {
var monthlyRate = annualRate / 12 / 100;
var months = years * 12;
var futureValue = 0;
for ( i = 1; i <= months; i++ ) {
futureValue = ( futureValue + investment ) *
(1 + monthlyRate);
}
$("futureValue").value = futureValue.toFixed(2);
}}
var clear_click = function () {
var investment = parseFloat();
var annualRate = parseFloat();
var years = parseInt();
}
window.onload = function () {
$("calculate").onclick = calculate_click;
$("investment").focus();
}
View 3 Replies
View Related