JavaScript - Birth.htm, Needing Help
This javascript code is supposedly to show the current date, and show a famous person's birthday on each day. Not sure if I am suppose to have birthdates in js files, or in first files.
[CODE]Filename: births.htm Supporting files: functions.js, logo.jpg --> <title>Welcome to Happy Birthday.com</title> <link href="styles.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript"> var births = new Array(); births[1] = "J.D. Salinger (1919) - Author"; births[2] = "Isaac Asimov (1920) - Author"; births[3] = "Clement Attlee (1883) - 42 Prime Minister"; births[4] = "Floyd Patterson (1935) - Heavyweight boxer"; births[5] = "King Camp Gillette (1855) - Invented safety razor"; births[6] = "Mel Gibson (1956) - Actor"; births[7] = "Millard Fillmore (1800) - 13th US President"; births[8] = "Elvis Aaron Presley (1935) - King of rock 'n' roll"; births[9] = "Richard Nixon (1913) - 37th US President"; births[10] = "George Foreman (1949) - Heavyweight boxing champ"; births[11] = "Alexander Hamilton (1755) - American Founding Father"; births[12] = "Joe Frazier (1947) - Heavyweight boxing champ"; births[13] = "Orlando Bloom (1977) - Actor"; births[14] = "Benedict Arnold (1741) - American"; births[15] = "Martin Luther King (1929) - Civil-rights "; births[16] = "Andre Michelin (1853) - Inventor of rubber tires"; births[17] = "Muhammad Ali (1942) - Boxer Cassius Clay"; births[18] = "David D Kaminsky (1913) - Danny Kaye"; births[19] = "James Watt (1736) - Inventor of the steam engine"; births[20] = "Edwin 'Buzz' Aldrin (1930) - Second man on Moon"; births[21] = "Telly Savalas (1924) - Actor"; births[22] = "Sam Cooke (1935) - Singer"; births[23] = "Princes Caroline (1957) - Royal of Monaco"; births[24] = "John Belushi (1949) - Actor"; births[25] = "Robert Burns (1759) - Scottish poet"; births[26] = "Paul Newman (1925) - Actor"; births[27] = "Amadeus Mozart (1756) - Composer"; births[28] = "Elijah Wood (1981) - Actor"; births[29] = "William McKinley (1843) - American President"; births[30] = "Franklin D. Roosevelt (1882) - American President"; births[31] = "Mario Lanza (1921) - Tenor singer"; births[32] = "Clark William Gable (1901) - Actor"; births[33] = "James Joyce (1882) - Author"; births[34] = "Gertrude Stein (1874) - Author"; births[35] = "Charles Lindbergh (1902) - Aviator"; births[36] = "John Boyd Dunlop (1840) - Inventor of the pneumatic tire"; births[37] = "Ronald Reagan (1911) - 40th US President"; births[38] = "Charles Dickens (1812) - Author"; births[39] = "James Dean (1931) - Actor"; births[40] = "Sandy Lyle (1958) - British golfer"; births[41] = "Harold Macmillan (1894) - 44th UK Prime Min"; births[42] = "Thomas Alva Edison (1847) - Inventor of the electric light bulb"; births[43] = "Abraham Lincoln (1809) - 16th US President"; births[44] = "George Segal (1934) - Actor"; births[45] = "Jimmy Hoffa (1913) - Union Leader"; births[46] = "Galileo Galilei (1564) - Italian astronomer"; births[47] = "John McEnroe (1959) - Tennis player"; births[48] = "Michael Jordan (1963) - Basketball player"; births[49] = "Enzo Ferrari (1898) - Sports car builder"; births[50] = "Prince Andrew (1960) - Queens 3rd child"; births[51] = "Sidney Poitier (1927) - First black Oscar win"; births[52] = "Jilly Cooper (1937) - Author"; births[53] = "George Washington (1732) - 1st US President"; births[54] = "Linda Nolan (1959) - Singer" births[55] = "Steven Jobs (1955) - Software pioneer"; births[56] = "George Harrison (1943) - Ex-Beatle guitarist"; births[57] = "William F Cody (1846) - Buffalo Bill"; births[58] = "Elizabeth Taylor (1932) - Actress Oscar winner"; births[59] = "Barry McGuigan (1961) - Featherweight boxer"; births[60] = "Gioacchino Rossini (1792) - William Tell Overture"; births[61] = "Glen Miller (1904) - Bandleader"; births[62] = "Mikhail Gorbachev (1931) - Soviet President"; births[63] = "Alexander G Bell (1847) - Inventor of telephone"; births[64] = "Patrick Moore (1923) - Astronomer"; births[65] = "William Oughtred (1574) - Inventor of the slide rule"; births[66] = "Valentine Tereshkova (1937) - First woman in space"; births[67] = "Armstrong Jones (1930) - Lord Snowdon (photographer)"; births[68] = "Karl Von Grafe (1787) - Plastic surgery pioneer"; births[69] = "Yuri Gagarin (1934) - First man in space"; births[70] = "Chuck Norris (1942) - Karate film actor"; births[71] = "Sir Harold Wilson (1916) - 46th UK Prime Min"; births[72] = "Liza Minnelli (1946) - Actress"; births[73] = "Joseph Priestley (1733) - Discoverer of oxygen gas"; births[74] = "Albert Einstein (1879) - Theory of relativity"; births[75] = "Andrew Jackson (1767) - 7th US President"; births[76] = "George Ohm (1787) - Measure of electricity"; births[77] = "Gottlieb Daimler (1834) - Inventor of the combustion engine"; births[78] = "Neville Chamberlain (1869) - 40th UK Prime Min"; births[79] = "David Livingstone (1813) - Explorer"; births[80] = "Mr. Rodgers (1928) - Children's entertainer"; births[81] = "Johann Sebastian Bach (1685) - Composer"; births[82] = "Andrew Lloyd Webber (1948) - British songwriter"; births[83] = "Sir Roger Bannister (1948) - First runner to break the four-minute mile"; births[84] = "Steve McQueen (1930) - Actor"; births[85] = "Reginald K Dwight (1947) - Singer Elton John"; births[86] = "Diana Ross (1944) - Singer"; births[87] = "Henry Royce (1863) - Co founder of Rolls-Royce"; births[88] = "Neil Kinnock (1942) - Former Labour leader"; births[89] = "John Major (1947) - 50th UK Prime Min"; births[90] = "Vincent Van Gogh (1854) - Dutch painter"; births[91] = "Gordie Howe (1928) - Hockey player"; births[92] = "William Harvey (1578) - Discoverer of blood circulation"; births[93] = "Hans Chris Andersen (1805) - The Ugly Duckling"; births[94] = "Doris Kappelhoff (1924) - Doris Day (actress)"; births[95] = "Maya Angelou (1928) - Poet"; births[96] = "Lord Joseph Lister (1827) - Introduced antiseptic"; births[97] = "Harry Houdini (1874) - Escape artist"; births[98] = "William Wordsworth (1843) - Poet"; births[99] = "Julian Lennon (1963) - Singer"; births[100] = "Isambard Brunel (1806) - Engineer of the Thames tunnel"; births[101] = "Michel Shalhouz (1932) - Actor Omar Sharif "; births[102] = "Joel Grey (1932) - Actor"; births[103] = "Tom Clancy (1947) - Author"; births[104] = "Garry Kasparov (1963) - British chess champ"; births[105] = "Rod Steiger (1925) - Acotr"; births[106] = "Leonardo da Vinci (1452) - Genius"; births[107] = "Charlie S Chaplin (1889) - Silent comedy actor"; births[108] = "Nikita Krushchev (1894) - Soviet leader"; births[109] = "Hayley Mills (1946) - Child star actress"; births[110] = "Dudley Moore (1935) - Actor 'Arthur' and '10'"; births[111] = "Adolf Hitler (1889) - German leader"; births[112] = "Queen Elizabeth II (1926) - Head of British Commonwealth"; births[113] = "Jack Nicholson (1938) - Actor"; births[114] = "William Shakespeare (1564) - Playwright and Poet"; births[115] = "Barbra Streisand (1942) - Singer"; births[116] = "Ella Fitzgerald (1918) - Singer"; births[117] = "Jet Li (1963) - Actor"; births[118] = "Samuel Morse (1791) - Inventor of Morse Code"; births[119] = "Saddam Hussein (1937) - Deposed Iraq President"; births[120] = "Hirohito (1901) - Emperor of Japan"; births[121] = "Kath Smith (1909) - Singer"; births[122] = "Duke of Wellington (1769) - 23rd UK Prime Min"; births[123] = "Harry (Bing) Crosby (1904) - Singer/Actor"; births[124] = "Arnold G Dorsey (1936) - Engelbert Humperdink"; births[125] = "Michael Barrymore (1952) - Entertainer"; births[126] = "Tammy Wynette (1942) - Singer"; births[127] = "Sigmund Freud (1856) - Psychoanalysis"; births[128] = "Johannes Brahms (1833) - German composer"; births[129] = "Harry S Truman (1884) - 33rd US President"; births[130] = "Glenda Jackson (1936) - Actress"; births[131] = "Fred Astaire (1899) - Actor and tap-dancer"; births[132] = "Phil Silvers (1912) - Actor"; births[133] = "Florence Nightingale (1820) - Crimean war nurse"; births[134] = "Stevie Wonder (1950) - Singer"; births[135] = "Thomas Gainborough (1727) - Landscape painter"; births[136] = "James Mason (1909) - Actor"; births[137] = "Henry Fonda (1905) - Actor"; births[138] = "Grace Jones (1955) - Singer"; births[139] = "Karol Wojtyla (1920) - Pope John Paul II"; births[140] = "Pete Townshend (1945) - Singer"; births[141] = "James M Stewart (1908) - Comedy actor"; births[142] = "Leo Sayer (1948) - Singer"; births[143] = "Laurence Olivier (1907) - Actor"; births[144] = "Joan Collins (1933) - Film & TV actress"; births[145] = "Queen Victoria (1819) - Longest reigning Queen"; births[146] = "Miles Davis (1926) - Musician"; births[147] = "Marion Morrison (1907) - Actor John Wayne"; births[148] = "Vincent Price (1911) - Horror movie actor"; births[149] = "Ian Fleming (1908) - Author"; births[150] = "John F Kennedy (1917) - 35th US President"; births[151] = "Peter the Great (1672) - Emperor of Russia"; births[152] = "Clint Eastwood (1930) - Actor"; births[153] = "Norma Jean Baker (1926) - Marilyn Monroe"; births[154] = "Johnny Weissmuller (1903) - Actor"; births[155] = "King George V (1865) - 2nd son of Edward VII"; births[156] = "Christopher Cockerel (1910) - Inventor of the hovercraft"; births[157] = "John Couch Adams (1819) - British Astronomer"; births[158] = "Robert Falcon Scott (1868) - 1st Brit to South Pole"; births[159] = "Tom Jones (1940) - Singer"; births[160] = "Nancy Sinatra (1940) - Singer"; births[161] = "George Stephenson (1781) - Inventor of the first steam locomotive"; births[162] = "Judy Garland (1922) - Singer"; births[163] = "Vince Lombardi (1913) - Coach of the Green Bay Packers"; births[164] = "George Herbert Bush (1924) - 41st US President"; births[165] = "Tim Allen (1953) - Actor"; births[166] = "Boy George (1961) - Singer "; births[167] = "Mario Cuomo (1932) - Former governor of New York"; births[168] = "Stan Laurel (1890) - Laurel & Hardy duo"; births[169] = "Barry Manilow (1946) - Singer"; births[170] = "Paul McCartney (1942) - Singer"; births[171] = "Blaise Pascal (1623) - French mathematician"; births[172] = "Errol Flynn (1909) - Action-adventure film"; births[173] = "Prince William (1982) - Prince & Princess Wales son"; births[174] = "Meryl Streep (1949) - Actress"; births[175] = "Charles R Darwin (1809) - Theory of evolution"; births[176] = "Jack Dempsey (1895) - Heavyweight boxing"; births[177] = "Eric Arthur Blair (1903) - George Orwell"; births[178] = "William T Kelvin (1827) - Inventor of the absolute temperature scale"; births[179] = "Helen Keller (1880) - Author"; births[180] = "Mel Brooks (1926) - Writer/Actor"; births[181] = "Nelson Eddy (1901) - Singer"; births[182] = "Mike Tyson (1966) - Boxer"; births[183] = "Dianna Spencer (1961) - Princess Diane"; births[184] = "Richard Petty (1937) - Racecar driver"; births[185] = "Tom Cruise (1962) - Actor"; births[186] = "Calvin Coolidge (1872) - American president"; births[187] = "Bjorn Borg (1980) - Wimbledon tennis champion"; births[188] = "Bill Haley (1925) - Singer"; births[189] = "Richard Starkey (1940) - Ringo Starr"; births[190] = "Ringo Starr (1940) - Ex-Beatle drummer"; births[191] = "Sir Edward Heath (1916) - 47th UK Prime Min"; births[192] = "Virginia Wade (1945) - Tennis champion"; births[193] = "Yul Brynner (1917) - Actor"; births[194] = "Josiah Wedgwood (1730) - Blue & white pottery"; births[195] = "Harrison Ford (1942) - Actor"; births[196] = "Gerald Rudolph Ford (1913) - 38th US President"; births[197] = "Rembrandt (1606) - Dutch artist & painter"; births[198] = "Roald Amundsen (1872) - First man to reach the South Pole"; births[199] = "James Cagney (1899) - Actor"; births[200] = "John Glenn (1921) - First man to orbit Earth"; births[201] = "Samuel Colt (1814) - Inventor of the colt revolver"; births[202] = "Sir Edmund Hillary (1919) - First to climb Mt. Everest"; births[203] = "Ernest Hemingway (1899) - Author"; births[204] = "Bob Dole (1923) - Former U.S. Senator"; births[205] = "Monica Lewinsky (1973)"; births[206] = "Amelia Earhart (1898) - 1st woman to fly Atlantic"; births[207] = "Arthur James Balfour (1848) - 33rd UK Prime Min"; births[208] = "Mick Jagger (1944) - Singer"; births[209] = "Joseph Hilary Belloc (1870) - Author"; births[210] = "Beatrix Potter (1866) - Author"; births[211] = "Peter Jennings (1938) - Journalist"; births[212] = "Emily Bronte (1818) - Wuthering Heights"; births[213] = "J. K. Rowling (1965) - Author"; births[214] = "Herman Melville (1819) - Author"; births[215] = "Peter O'Toole (1932) - Lawrence of Arabia"; births[216] = "Stanly Baldwin (1868) - 38th UK Prime Min"; births[217] = "Queen Elizabeth (1900) - King George 6th wife"; births[218] = "Neil Armstrong (1930) - First man on the Moon"; births[219] = "Andy Warhol (1928) - Artist"; births[220] = "Mata Hari (1876) - Spy for the Germans"; births[221] = "Dustin Hoffman (1937) - Actor"; births[222] = "Thomas Telford (1757) - Road & bridge Engineer"; births[223] = "Herbert Clark Hoover (1874) - 31st US President"; births[224] = "Enid Blyton (1897) - Author"; births[225] = "King George 4th (1762) - King of England"; births[226] = "John Logie Baird (1888) - Inventor of television"; births[227] = "John Galsworthy (1867) - Author"; births[228] = "Napoleon Bonaparte (1769) - French leader"; births[229] = "Madonna (1959) - Singer"; births[230] = "May West (1892) - Actress"; births[231] = "Robert Redford (1937) - Actor"; births[232] = "Orville Wright (1871) - Inventor of the first airplane"; births[233] = "Jim Reeves (1924) - Singer"; births[234] = "William Murdock (1754) - Inventor of coal-gas lighting in 1792"; births[235] = "Ray Bradbury (1920) - Author"; births[236] = "Gene Kelly (1912) - Actor/Dancer"; births[237] = "Craig Kilborn (1962) - Actor"; births[238] = "Sean Connery (1930) - Actor"; births[239] = "Robert Walpole (1676) - 1st UK Prime Minister"; births[240] = "Sam Goldwyn (1910) - Film producer"; births[241] = "David Soul (1828) - Actor"; births[242] = "Michael Jackson (1958) - Singer"; births[243] = "Denis Healey (1917) - Politician"; births[244] = "Sir Bernard Lovell (1928) - Inventor of the radio telescope"; births[245] = "Rocky Marciano (1923) - Heavyweight boxer"; births[246] = "Salma Hayek (1968) - Actress"; births[247] = "Alan Ladd (1913) - Actor"; births[248] = "Tom Watson (1949) - Golfer"; births[249] = "Raquel Welch (1940) - Actress"; births[250] = "Britt Ekland (1942) - Actress"; births[251] = "Queen Elizabeth I (1533) - Queen of England"; births[252] = "King Richard I (1157) - Richard the Lion Heart"; births[253] = "William Bligh (1754) - Mutiny on the Bounty"; births[254] = "Arnold Palmer (1929) - US golfing champion"; births[255] = "O. Henry (1862) - Author"; births[256] = "Richard Gatling (1818) - Inventor of the Gatling Gun"; births[257] = "Claudette Colbert (1905) - Actress"; births[258] = "Jack Hawkins (1910) - British film actor"; births[259] = "Agatha Christie (1891) - Detective storywriter"; births[260] = "B. B. King (1925) - Musician"; births[261] = "John Ritter (1948) - Actor"; births[262] = "Samuel Johnson (1709) - 18th century writer"; births[263] = "George Cadbury (1839) - Chocolate manufacturer"; births[264] = "Sophia Loren (1934) - Italian film actress"; births[265] = "H G Wells (1866) - Science fiction novelist"; births[266] = "Michael Faraday (1791) - Inventor of the electric generator 1831"; births[267] = "Julio Iglesias (1943) - Singer"; births[268] = "Anthony Newley (1931) - Actor"; births[269] = "Meat Loaf (1947) - Singer"; births[270] = "George Gershwin (1898) - Composer"; births[271] = "Mike Schmidt (1949) - Baseball player"; births[272] = "Lech Walesa (1943) - Founder of Solidarity"; births[273] = "Horatio Nelson (1758) - Commander"; births[274] = "Johnny Mathis (1935) - Singer"; births[275] = "Jimmy Carter (1924) - 39th American President"; births[276] = "Mahatma K Gandhi (1869) - Hindu spiritual leader"; births[277] = "Chubby Checker (1941) - Singer"; births[278] = "Buster Keaton (1895) - Silent film comedy actor"; births[279] = "Donnald Pleasence (1919) - Actor"; births[280] = "George Westinghouse (1846) - Inventor of the railway air brake"; births[281] = "Yo-Yo Ma (1955) - Musician"; births[282] = "R. L. Stine (1943) - Author"; births[283] = "John Lennon (1940) - Beatles song writer"; births[284] = "William Morris (1877) - Motoring pioneer"; births[285] = "Henry J Heins (1844) - Food products manufacturer"; births[286] = "Ramsay MacDonald (1866) - 39th British Prime Minister"; births[287] = "Margaret H Thatcher (1925) - First woman Prime Minister"; births[288] = "Dwight Eisenhower (1890) - 34th American President"; births[289] = "John L Sullivan (1858) - World heavyweight boxing champion"; Similar TutorialsHi All, My first question on this forum. I have a form where we are capturing the Members Children information. I want to insert age in years to a field within this table by calculating age from Date of Birth (DOB). DOB format is mm/dd/yyyy and is a datetime data type in SQL. The DOB is added by the member while registering their child. Is there an onchange script that I could use here. Is it possible to auto populate a field from an other field within the same form?? Does anyone have any code samples that I could use?? Any pointers will be greatly appreciated. Thanks Vinny Code: <script type="text/javascript"> /*********************************************** * Drop Down Date select script- by JavaScriptKit.com * This notice MUST stay intact for use * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more ***********************************************/ var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield) var monthfield=document.getElementById(monthfield) var yearfield=document.getElementById(yearfield) for (var i=0; i<31; i++) dayfield.options[i]=new Option(i, i+1) dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year } </script> This script when the year is selected chooses 2011-2030 but I want like 1900-2011 How do I fix this and then how would I make sure that it isn't blank and then sends this data to one field in my database called "dob" in form "0000-00-00".. thanks.. Hi , I am using date of birth field in my application and i m taking date of birth in yyyy-mm-dd format. I need to calculate age by using this date of birth and should show alert if age is less than 5 years. help me.... Thanks in advance I have a date of birth drop down for 'Day', 'Month' and a text field for Year. How can I get the select value of the drop down and year text field into a single text field, separated by '-'? The single text field would need to update if someone changed the drop down / year selections. Hope someone can help - I'm stumped! I'm completely new to Java Script, but about a year ago I decided to learn how to build a website from scratch. I am confident with HTML and CSS, but Java seems to be flying over my head. Could anybody possibly help me with my coding? I'm sure the problem is obvious, but I don't know if this is the right place to post this sort of beginnier question. So if it is not, please redirect me to where I can. Thanks a lot! Quote: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title></title> </head> <body> <script type="text/javascript"> function addzero(zero) { return zero; } var d = new Date(); var time=d.getHours function tod1 () { document.write("The time is "); document.write(addzero(d.getHours())); document.write(":"); document.write(addzero(d.getMinutes())); } function tod2 () { document.write("The time is "); document.write(addzero(d.getHours()+1)); document.write(":"); document.write(addzero(d.getMinutes())); } function tod3 () { document.write("The time is "); document.write(addzero(d.getHours()+2)); document.write(":"); document.write(addzero(d.getMinutes())); } function tod4 () { document.write("The time is "); document.write(addzero(d.getHours()+3)); document.write(":"); document.write(addzero(d.getMinutes())); } if (time>10) { alert("Good morning"); } </script> <p id="city"></p> <form name="form" action="wtf.php" method="post"> Vancouver: <input type="radio" name="city" id="Vancouver" onchange="tod1()"> Calgary: <input type="radio" name="city" id="Calgary" onchange="tod2()"> Winnipeg: <input type="radio" name="city" id="Winnipeg" onchange="tod3()"> Toronto: <input type="radio" name="city" id="Toronto" onchange="tod4()"> </form> </body> </html> This is my first time in this forum. I've been searching all day for a solution to the js problem I have. I think I've worked outa what I need to do with the code I have to get my page working but I don't know how to amend the code to what I need. I have a form which I'm using to return a number count of records in my db. Each time a select is changed in the form it calls a function which generates a url based on the selections and then returns this to the page. There are 2 parts of this I'm struggling with. 1. First is a checkbox which allows a user to return all results or only results with an image. The problem I have is that the code below will always show the checkbox with a value. 2. There will be occasions where the model field is not present in the form, how can I change the code below so that it checks to see if there is a model value and if there is none it just doesn't put the model var in the url string that it generates. Please can someone help me. I've posted threads on other forums and no-one will reply. Any help would be greatly appreciated with this, the code I'm trying to change is below. Code: function showTotalUsedBikes(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ticker'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var drop_1 = document.getElementById('drop_1').value; var model = document.getElementById('model').value; var mileage = document.getElementById('mileage').value; var colour = document.getElementById('colour').value; var age = document.getElementById('age').value; var min_price = document.getElementById('min_price').value; var max_price = document.getElementById('max_price').value; var min_engine_size = document.getElementById('min_engine_size').value; var max_engine_size = document.getElementById('max_engine_size').value; //var pics = document.getElementById('pics').value; var pics = $('input:checkbox:checked').val(); // get the value from a checked checkbox var keywords = document.getElementById('keywords').value; var queryString = "?drop_1=" + drop_1 + "&model=" + model + "&mileage=" + mileage + "&colour=" + colour + "&age=" + age + "&min_price=" + min_price + "&max_price=" + max_price + "&min_engine_size=" + min_engine_size + "&max_engine_size=" + max_engine_size + "&pics=" + pics + "&keywords=" + keywords; ajaxRequest.open("GET", "numberOfBikes.php" + queryString, true); ajaxRequest.send(null); } Hi, I'm currently building a website at the moment & I have a feature on the page that I would like to perform a nice slideshow. However, its not just in a single square frame, i've made it nice and complicated for myself that i've kind of got myself in a muddle trying to work out the best way of going about this feature. Below is an image that'll hopefully save me from babbling too much. So as you can see, in photoshop i've used masking on the images to produce the effect. So at the moment, two images are showing...each taking up four of these rectangles. I'd like every 7 seconds lets say, for both images to slide off and two more to replace them. Whats the best way to do this? As i'm wanting to use jquery/javascript for this feature. thanks for any advice. heelo people im hoping someone can help me with this for some reason my code isnt working can anyone help me fiind a solution thanks Code: <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Activity 14 question 1 </title> </head> <body> <h1>Comparing Height</h1> <p>Click on the button to compare heights</p> <script type="text/javascript"> <!-- function height() { var height; var DispWin; DispWin = window.open("","NewWin", " width=400,height=200"); if(height <178); { DispWin.document.write("Your height is less than or equal to the average"); } else { DispWin.document.write("Your height is more than or equal to the average"); } } --> </script> <form name="calch"> <p>height: <input type="text" size="10" name="compare height" /></p> <p><input type="button" value="Compare Height" onClick="height(document.calch.height.value;" /> </p> </form> </body> </html> thanks So I have a scheduler on a website that shows events . Currently, the scheduler defaults to 1 pm. However, I would like it to default to the time of day to show what is happening right now. So, says it's 5 p.m., when someone visits the site, I'd like it to automatically open up to 5pm. I talked to the creator of it and he said it can be done through javascript. Any ideas of what I would add to this script to do so? <script type="text/javascript" src="http://kacvtv.org/rotatorjs/flashobject.js"></script> <div id="flashcontent"><a href="/Schedule/"><img border="0" src="/images/flash_viewschedule.gif" alt="" /></a><a href="http://www.macromedia.com/go/getflashplayer"><img border="0" src="/images/flash_getflash.gif" alt="" /></a></div> <script type="text/javascript">var fo = new FlashObject("/schedule.swf?currentTime=Nov 29, 2006 01:20:27 PM", "homeflash", "595", "240", "7", "#FFFFFF"); fo.addParam("wmode","transparent"); fo.write("flashcontent"); </script> Hello all, I've been working on a webcode for a basic form and check page. The forms work, just I'm having an issue with when I submit the form, even with incomplete data (AKA the email verification) it submits anyway instead of halting the page. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>About</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link type="image/x-icon" rel="SHORTCUT ICON" href="EpicIcon.ico" /> <script type="text/javascript"> /* <![CDATA[ */ function firstNameFunc(){ if(document.forms[0].myName.value == 'Enter your first name here.'){ document.forms[0].myName.value = ''; } } function firstNameBlur(){ if(document.forms[0].myName.value == ''){ document.forms[0].myName.value = 'Enter your first name here.'; } } function lastNameFunc(){ if(document.forms[0].myName2.value == 'Enter your last name here.'){ document.forms[0].myName2.value = ''; } } function lastNameBlur(){ if(document.forms[0].myName2.value == ''){ document.forms[0].myName2.value = 'Enter your last name here.'; } } /**E-Mail verification and codes**/ <!--Beginning regular expression function for e-mail check--> <!--End test for Regular Expression--> function emailFocus(){ if(document.forms[0].myEMail.value == 'Enter your email here.'){ document.forms[0].myEMail.value = ''; } } function emailBlur(){ if(document.forms[0].myEMail.value == ''){ document.forms[0].myEMail.value = 'Enter your email here.'; } } <!--Verifying to submitting/resetting the form--> function confirmSubmit(){ var formSubmit = window.confirm("Are you sure you wish to submit the form?"); var emailReg = new RegExp(/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.(com|org|net|edu|gov)$/); /** -- ^[a-zA-Z0-9._-] will check for alpha-numeric characters (upper/lower) as well as allow periods, hyphens, and underscores. -- @ is the combining symbol for email adresses. -- [a-zA-Z0-9.-]+ will allow another set of alpha-numeric numbers that can also contain periods and hyphens. -- \. will seperate the characters from the domain and subdomains. -- (com|org|net|edu|gov)$/ will limit which domains those are. **/ if(document.forms[0].myName.value =='' ||document.forms[0].myName2.value =='' ||document.forms[0].myEMail.value ==''){ alert("You must enter data in the 'First Name,' 'Last Name,' and 'E-Mail' fields."); return false; } else if(document.forms[0].myEMail.value == 'Enter your email here.'){ document.forms[0].myEMail.value = ''; }if(document.forms[0].myEMail.value != ''){ if(emailReg.test(document.forms[0].myEMail.value) == false){ window.alert("Non-certified email used!"); document.forms[0].myEMail.focus(); document.forms[0].myEMail.select(); return true; } return false;} return true; } function confirmReset(){ var formReset = window.confirm("Are you sure you wish to reset the form?"); if(formReset == true) return true; return false; } <!--End of verification--> /* ]]> */ </script> </head> <body> <p align="center"> <form id="userInfo" method="post" onsubmit="confirmSubmit()" onreset="confirmReset()"> <table border="0"> <tr><td> First Name: </td><td align="center"><input type="text" id="myName" value="Enter your first name here." onFocus = "firstNameFunc()" onBlur="firstNameBlur()"/></td></tr> <tr><td>Last Name: </td><td align="center"><input type="text" id="myName2" value="Enter your last name here." onFocus = "lastNameFunc()" onBlur="lastNameBlur()"/></td></tr> <tr><td>E-Mail: </td><td align="center"><input type="text" id="myEMail" value="Enter your email here." onFocus = "emailFocus()" onBlur="emailBlur()"/></td></tr> <tr><td>Message: </td><td align="center"> <textarea id="message" cols="40" rows="5" onFocus="document.forms[0].message.value='';">Enter a message here...</textarea> </td></tr> <tr><td><td align="center"> <input type="Submit" value="Submit"/> <input type="Reset" value="Reset"/> </td></td></tr> </table> </form> </p> <a href="about.html">Click to return</a> </body> </html> Now I've tried making a seperate function for the regular expression and e-mail verification and got no where with it (though I'm sure it can be done easily). My question (though it is bolded): How do I prevent the page from continuing the submit function if data is incomplete? EDIT Code: function confirmSubmit(){ var formSubmit = window.confirm("Are you sure you wish to submit the form?"); var emailReg = new RegExp(/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.(com|org|net|edu|gov)$/); /** -- ^[a-zA-Z0-9._-] will check for alpha-numeric characters (upper/lower) as well as allow periods, hyphens, and underscores. -- @ is the combining symbol for email adresses. -- [a-zA-Z0-9.-]+ will allow another set of alpha-numeric numbers that can also contain periods and hyphens. -- \. will seperate the characters from the domain and subdomains. -- (com|org|net|edu|gov)$/ will limit which domains those are. **/ if(document.forms[0].myName.value =='' ||document.forms[0].myName2.value =='' ||document.forms[0].myEMail.value ==''){ alert("You must enter data in the 'First Name,' 'Last Name,' and 'E-Mail' fields."); return false; } else if(document.forms[0].myEMail.value == 'Enter your email here.'){ document.forms[0].myEMail.value = ''; }if(document.forms[0].myEMail.value != ''){ if(emailReg.test(document.forms[0].myEMail.value) == false){ window.alert("Non-certified email used!"); document.forms[0].myEMail.focus(); document.forms[0].myEMail.select(); return true; } return false;} return true; } I dont know the first thing about java script but I also didnt know the first thing about html and css but someone showed me a few basic things to gt started and Ive excelled in both using dreamweaver. I just needed the basics and then I was able to work through it. Just like that I need help starting out with Java Script. Basically, Ive made a website and now I am trying to put in a slider(it is a photo slider which has a box drop down on the right with a description when it changes photos.) I was told to make a slider.css file in the css folder and a slider.js file in the java script folder. I coded everything correctly in the source code page to get the slider up and running. But it wont work. Am I supposed to have a Java script program downloaded or something? Please help if you know what Im talking about Ive hit a road block and if you can walk me through this process I would really appreciate it and I can continue with my project. Thanks Starting off by saying this is directly from a book: Code: <script type="text/javascript"> /* <![CDATA[ */ function validateCard(){ //American Express if(document.forms[0].cardName.value =="American Express"){ var cardProtocol = new RegExp("^3[47][0-9]{13}$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } //Diners Club else if(document.forms[0].cardName.value =="Diners Club"){ var cardProtocol = new RegExp("^3(?:0[0-5]|[68][0-9])[0-9]{11}$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } //Discover else if(document.forms[0].cardName.value =="Discover"){ var cardProtocol = new RegExp("^6(?:011|5[0-9]{2})[0-9]{12}$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } //JCB else if(document.forms[0].cardName.value =="JCB"){ var cardProtocol = new RegExp("^(?:2131|1800|35\d{3})\d{11}$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } //Mastercard else if(document.forms[0].cardName.value =="Mastercard"){ var cardProtocol = new RegExp("^5[1-5][0-9]{14}$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } //Visa else if(document.forms[0].cardName.value =="Visa"){ var cardProtocol = new RegExp("^4[0-9]{12}(?:[0-9]{3})?$"); if(cardProtocol.test(document.forms[0] .cardNumber.value)) document.forms[0].ccResult.value ="Valid credit card number"; else document.forms[0].ccResult.value ="Invalid credit card number"; } } /* ]]> */ </script> With a drop down box for the card type and a text-box to input a credit card number of appropriate length. My question, the teacher asked us to help make this code more "efficient" and I'm still learning the language, and was wondering if a loop could be utilized to make the code more efficient? Switch statement would just repeat the code practically So I was asked to input a recipe coding into my page, so that when you get the output of the servings, it's multiplied by what I put in the code. Here is the assignment : http://webct.dvc.edu/SCRIPT/COMSC100...C100_5059_FA11.. it's assignment # 7 and here is my coding ; html> <head> <title> COMSC 100 Assignment 7 by John Doe [1190802] </title> <script> function getInputAsText(_id){return document.getElementById(_id).value} function getInputAsNumber(_id){return parseFloat(document.getElementById(_id).value)} function setOutput(_id, _value){document.getElementById(_id).value = _value} function calculate() { // declare all variables var amount1 var amount2 var amount3 var amount4 var amount5 // get variable's value first = getInputAsNumber("first") second = getInputAsNumber("second") third = getInputAsNumber("third") fourth = getInputAsNumber("fourth") fifth = getInputAsNumber("fifth") // perform conversions amount1=amount1 / servingsBase * servingsNeeded amount2=amount2 / servingsBase * servingsNeeded amount3=amount3 / servingsBase * servingsNeeded amount4=amount4 / servingsBase * servingsNeeded amount5=amount5 / servingsBase * servingsNeeded // write output value setOutput("servingsBase", servingsNeeded) } </script> </head> <body> Recipe Converter:<br> To change the recipe for each<br> type the amount of each ingrediant<br> type the amount of servings<br> click go<br> converted amounts will where original amounts we <br> <br> Input AND Output values:<br> For this many servings: <input id="first"> sugar:<input id="second"><br> milk:<input id="third"><br> food:<input id="fourth"><br> water:<input id="fifth"><br> <input type="submit" value="go" onclick="calculate()"><br> </body> </html> what am I doing wrong?! my teacher is no help at all! ugh Okay so this is a homework assignment. I have completed MOST of it. What I am completely lost on is how make the totals show up in the shipping fee section based on what products the user selects. "When the user selects an option from the Hand Tool selection list (and only the Hand Tool selection list) Display $20.00 in the Item 1 text box. Display $0 in the Item 2 text box. Display $5.00 in the Shipping text box. Display $25.00 in the Total text box. When the user selects an option from the Power Tool selection list (and only the Power Tool selection list) Display $0 in the Item 1 text box. Display $30.00 in the Item 2 text box. Display $10.00 in the Shipping text box. Display $40.00 in the Total text box. When the user selects both an option from the Hand Tool selection list and an option from the Power Tool selection list Display $20.00 in the Item 1 text box. Display $30.00 in the Item 2 text box. Display $15.00 in the Shipping text box. Display $65.00 in the Total text box. If the user returns back to the default (the words Hand Tool and Power Tool in the selection list) you must treat that as de-selecting the tool and change the text boxes accordingly." Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Project 2 </title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="js_styles.css" type="text/css" /> <script type="text/javascript"> /* <![CDATA[ */ function jumpto(x){ if (document.form1.jumpmenu.value != "null") { document.location.href = x } } function checkForNumber(fieldValue) { var numberCheck = isNaN(fieldValue); if (numberCheck == true) { window.alert("You must enter a numeric value!"); return false; } } function confirmSubmit() { if (document.forms[0].first_name.value == "" || document.forms[0].last_name.value =="" || document.forms[0].address_1.value =="" || document.forms[0].city.value =="" || document.forms[0].state.value == "") { window.alert("You have not entered the requested personal information."); return false; } } function confirmReset() { var resetForm = window.confirm("Are you sure you want to reset the form?"); if (resetForm == true) return true; return false; } /* ]]> */ </script> </head> <body> <h2>Purchase Order</h2> <form action="FormProcessor.html" method="get" enctype="application/x-www-form-urlencoded" onsubmit="return confirmSubmit();" onreset="return confirmReset();"> <h3>Products</h3> Hand Tools $20.00 <select name="jumpmenu" onChange="jumpto(document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value)"> <option value="$0.00">Hand Tool</option> <option value="$20.00">Saw</option> <option value="$20.00">Hammer</option> <option value="$20.00">Screwdriver</option> <option value="$20.00">Wrench</option> <option value="$20.00">Pliers</option> </select> Power Tool $30.00 <select name="jumpmenu" onChange="jumpto(document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value)"> <option value="$0.00">Power Tool</option> <option value="$30.00">Circular Saw</option> <option value="$30.00">Sabre Saw</option> <option value="$30.00">Drill</option> <option value="$30.00">Belt Sander</option> <option value="$30.00">Table Saw</option> </select> <h3>Shipping Fees</h3> <p>Item 1: <input type="text" name="city" size="15" /> Item 2: <input type="text" name="city" size="15" /> Shipping: <input type="text" name="city" size="15" /> Total: <input type="text" name="city" size="15" /> <h3>Customer Information</h3> <p>First Name <input type="text" name="first_name" size="25" value="First Name" onclick="document.forms[0].first_name.value = '';" /> Last Name <input type="text" name="last_name" size="25" value="Last Name" onclick="document.forms[0].last_name.value = '';" /> <p>Street Address 1 <input type="text" name="address_1" size="50" value="Address 1" onclick="document.forms[0].address_1.value = '';" /> <p>City <input type="text" name="city" size="20" value="City" onclick="document.forms[0].city.value = '';" /> State <input type="text" name="state" size="15" value="State" onclick="document.forms[0].state.value = '';" /> Zip <input type="text" name="zip" size="10" value="Zip" onclick="document.forms[0].zip.value = '';" /> <p>Phone <input type="text" name="phone" size="20" value="Phone" onchange="return checkForNumber(this.value)" onclick="document.forms[0].phone.value = '';" /> Fax <input type="text" name="fax" size="20" value="Fax" onchange="return checkForNumber(this.value)" onclick="document.forms[0].fax.value = '';" /> <p>Payment Method? <input type="radio" name="visa" />Visa<input type="radio" name="master_card" />Master Card <input type="radio" name="american_express" />American Express</p> <p>Credit Card Number <input types="text" name="cc_number" size="50" /> <p> Expiration Month: <select name="jumpmenu" onChange="jumpto(document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value)"> <option>Month</option> <option value="january">January</option> <option value="february">February</option> <option value="march">March</option> <option value="april">April</option> <option value="may">May</option> <option value="june">June</option> <option value="july">July</option> <option value="august">August</option> <option value="september">September</option> <option value="october">October</option> <option value="november">November</option> <option value="december">December</option> </select> Expiration Year <select name="jumpmenu" onChange="jumpto(document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value)"> <option>Year</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> </select> </p> <p><input type="image" alt="Graphical image of a subscribe button" src="subscribe.png" /></p> <p><input type="reset" value="Reset Registration Form" onchange="confirmReset" /></p> </form> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" style="border: 0px;" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img src="http://www.austincc.edu/jscholl/images/vcss.png" alt="Valid CSS!" height="31" width="88" style="border: 0px;" /></a> </p> </body> </html> I'm not looking for someone to complete this for me. I just need some help with how I would write a function for this. Hi I use dreamweaver to build sites, and so don't really have to do much with the code, however adobe cs5 has removed the navigation bar tool and I am totally lost without it. I know Java script is needed... Could anyone help? If someone has some code ,for a vertical navigation bar with 8 buttons, 3 images for each button, buttonup mouse over and button down (which is of course a link to another page), that I could copy and edit, it would help alot! |