JavaScript - Newbie Needing Some Help Please!
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); } Similar Tutorialsheelo 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 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! 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"; 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> 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. 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> 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 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; } 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. 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 I am trying to create a personal webpage within Frames. The problem is, when I start the left frame, the main frame does what it's supposed to do, but if I click into the mainframe, it opens in an entirely new window, therefore losing my Frameset. I want to be able to visit webpages I have in an Array and be able to use the webpages (surf them, click on links and such). Please forgive the sloppy coding, I am a beginner. This is what I have so far: Frameset: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <frameset cols="220,*" border=5> <frame src="leftFrame.html" name="side" sideborder=1 Scrolling="no" marginwidth="5" marginheight="5" noresize> <frame src="mainFrame.html" name="main" sideborder=1 Scrolling="yes" marginwidth="5" marginheight="5" noresize> </frameset><noframes></noframes> </frameset> <body> </body> </html> Left Frame: Code: <html> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var page = new Array( "http://google.com" "http://ebay.com" "http://facebook.com" ); var endpage = "/the-end.html"; var slidenum = 0; var slidecount = page.length; var timerID = 0; var show_is_on = 0; var timedelay; var iteration; function showSlideShow() { slidenum++; if (slidenum < slidecount+1) { parent.main.location.href = page[slidenum-1]; document.getElementById('slnum').innerHTML = slidenum } if (slidenum == slidecount+1) { parent.main.location.href = endpage; } else timerID = setTimeout('showSlideShow()', timedelay); } function doShow() { if (!show_is_on) { show_is_on = 1; iteration = document.getElementById('startfrom').value if (iteration > 0) { slidenum = iteration-1 } setTimer(document.getElementById('interval').value); showSlideShow(); } } function stopShow() { clearTimeout(timerID); show_is_on = 0; } function setTimer(milliseconds) { timedelay = milliseconds; } // End --> </script> </HEAD> <P> <form name="form1"> Time delay: <input type="text" size="4" name="interval" id="interval" value="7000" /> <br>(In milliseconds) <P><input type="button" value="Start process" onClick="doShow()" /> <P><input type="button" value="Pause process" onClick="stopShow()" /> <P>Jump to:<input type="text" size="4" name="startfrom" id="startfrom" value="0" /> <P>Progress: <b id="slnum">0</b> of <b id="slcount">0</b> </form> <SCRIPT LANGUAGE="JavaScript"> document.getElementById('slcount').innerHTML = slidecount </SCRIPT> </HEAD> <BODY> </BODY> </html> Main Frame: Code: <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> Thanks in advance! Hi what i'm trying to do is have it when once a user clicks on a banner the join raffle button will show after clicking on the banner, along with opening up a new window to the link the banner had. I've been trying to set up a onclick event to do this but haven't had success any help would be appreciated. This is the code ive tried using. <div class="moduletable"> <a onclick="{AUP::RAFFLE=4}" href="http://godaddy.com" target="_blank" mce_href="http://godaddy.com"><img src="/images/stories/godaddy%20image.jpg" alt=""></a> </div> Here is the code for the raffle <tr> <td valign="top" colspan="2"> <form action="" method="post" name="RaffleForm"> <input type="hidden" name="aupraffleid" id="aupraffleid" value="4" /> <input type="hidden" name="aupraffleuserid" id="aupraffleuserid" value="63" /> <input type="hidden" name="auprafflepoints" id="auprafflepoints" value="1" /> <input type="hidden" name="auprafflepointsremove" id="auprafflepointsremove" value="1" /> <input class="button" type="submit" name="Submit" value="Sign up for this raffle now!" /> </form> </td> </tr> I created a new website for documentation on the product we sell. It can be found at www.predatorgames.info. On the main page is this nice looking jquery photobox. When you click on the smaller pictures it will reload the main one. My problem is how do I make it so that when you click on the large image it will link to another site. Moreover, when they click on the small image it will load a new large image and I would want that to go to a different site if clicked. Dynamic. I was hoping someone could look at the source and tell me where I need to make the change. Please be specific as this is new to me. Thanks ahead of time for the help! Hi guys, i am trying to work with google maps api my issue is with creating an array of markers count the number of marker, and then if it equal two, issue an error msg. i wrote some code, but that doesn't work obviously. and my question is how do i write that code in javascript ? GEvent.addListener(map, 'click', function (overlay, latlng) { if (placeMarker.length < 2) { pendingLatLng = latlng; setTimeout("settleClick()", 225) } else { message("You can only select 2 points."); } }); a sample click event which looks like the line below does work. what am i doing wrong ?: google.maps.event.addListener(map, 'click', function (event) {placeMarker(event.latLng); }) Hi, I am brand new to any sort of programming and am taking an HTML class this quarter. We just started javascript and I am working on an assignment where we make a number guessing game. I have been working on this code for a few days and simply cannot figure out what is wrong. It simply doesn't work and at times locks up my browser (Mozilla Firefox). I don't want anyone to write the code for me, I just need a push to begin to understand what I'm doing wrong. Here is what I have so far: <code> <script type="text/javascript"> function guessingGame(){ var secretNumber=Math.floor(Math.random()*100)+1; var numberOfGuesses=0; var guessNumber=parse.Int(document.getElementById('guessNumberValue').value); document.getElementById("guessNumber").value=guessNumber; while (guessNumber!=secretNumber) { if (guessNumber<secretNumber) document.EricaGuess.response.value="Number too low"; if (guessNumber>secretNumber) document.EricaGuess.response.value="Number too high"; if (guessNumber==secretNumber) document.EricaGuess.response.value="You guessed the correct number!";} numberOfGuesses++; document.EricaGuess.numberOfGuessesValue.value=numberOfGuesses; } </script> </head> <body> <form name="EricaGuess"> <div id="Welcome"> <h2> Welcome to Ericas Guessing Game</h2> <p> Enter a number between 1 and 100. See how quickly you can figure out the magic number</p> <input type="button" value="Guess" onclick="guessingGame()"/> <input type="button" value="Reset" onclick="reset"/> <input type="text" id="guessNumber" name="guessNumberValue"/> <input type="text" id="response" name="response" size="75"/> <input type="text" id="numberOfGuessesValue" name="numberOfGuessesValue"/> </code> This is minus the opening and closing tags. Like I said, I am not asking for anyone to code this for me, just some help to understand what the problems are (I'm sure there are many). Thanks for any help you can give. Hi, I am trying to learn how to use radio buttons in javascript without using functions. This is what I did but it does not work: <script language="javascript"> var season3pointer = "Ray Allen" if (season3pointer == Ray Allen) { alert("Good Answer"); } else { alert("You don't know anything about the Celtics") } document.write("<form action='http://www.nba.com/celtics/' method='post'>"+"<p>"+"Who has the record for most 3 points made in a game?"+ "<br/>"+"<input type='radio' name='game-3-pointer' value='bestrecord'>"+season3pointer+ "Antoine Walker"+"<br />"); </script> I know it should be very easy, but so far I have only found how to do it using functions, any help truly appreciated. Hi everyone! I want to delete all nodes, but leave one div in my html. var p = document.getElementById('container'); var leave= document.getElementById('leave_this'); while (p.hasChildNodes()) { if(leave != p.childNodes){ p.removeChild(p.firstChild); } } Please help. Cheers I have a js file to clean up a textarea when someone copies from a MS Word. I would like to be able to have this remove all the MS Word on submit rather than select a button in an editor. The cleanup.js in located in an includes folder and here is the submit form. How do I include the cleanup.js in this. Any help would be greatly appreciated! Code: <script language='javascript'> function saveChanges(saveDel) { //set the value based on save,delete, or edit document.editDelete.saveDel.value=saveDel; var retVal=true; document.editDelete.saveDel.onsubmit(); document.editDelete.saveDel.value=saveDel; if(saveDel=='delete') { //bring up a confirm if the user clicks delete retVal=confirm("Permanently delete the current record?"); } if(retVal) { //we can active the submit of the form document.editDelete.saveDel.onsubmit(); document.editDelete.submit(); } } </script> Hi - can you please tell me the correct syntax for this please? Both scripts 'CalculateBasic' and 'CalculateTape' both happily return the correct amount - all I want to do is add them up to give me a form.price.value I just can't seem to get the right syntax. <script type="text/javascript"> function CalculateTot(form) { form.price.value = CalculateBasic(form) + CalculateTape(form); } </script> Please can you help Thanx |