JavaScript - Javascript/css/html Help!
Two things:
I'm making a website for my online portfolio for Uni... 1. I want to make a prev|next (preferably with the numbers after too if possible) to flick through my work so I don't have to scroll around the page. 2. I want to create a slide down menu that stays open when an option is selected. Hope I've explained it well! Thanks in advance Similar Tutorialsfavorite I'd like to modify a form on www.formsite.com (form builder app): username: testuser password: password I would like to use the nicedit.com's inline content editor's js to transform my textarea's into a richtext area. At present the nicedit editor works well in creating the richtextarea. However, the KEY point is that I would like formsite's form to pipe in the the created html and render it with the html component of formsite. Currently, the pipe function in formsite will only put out the html syntax in it's html module. action seen he http://fs8.formsite.com/testform/form1/index.html So this would be: 1. checking out my form on formsite.com 2. the script from nicedit.com is already installed in an html component. 3. changing or telling me the scripts/tags/or whatever for formsite form using formsites form builder (which allows some html/script editing). 4. changed so as to render the rich text entered on page 1 in page 2 instead of the html syntax. Any other solutions using formsite and any other richtextarea solutions would be great too! Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks Ok, problem has been solved! ^^
I am making an webpage where you get two random photos and you click using the arrow keys which one you like best and that one stays and goes on the versus the next random photo. I got it so far when you start the page it sets two random pictures but i dont know how to do key inputs on html Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Which Is better?</title> <h1 align = center>Which is better?</h1> <script language="JavaScript"> var theImages = new Array() var thePictures = new Array() thePictures[1] = 'untitled-1.jpg' thePictures[2] = 'untitled-2.jpg' thePictures[3] = 'untitled-3.jpg' thePictures[4] = 'untitled-4.jpg' thePictures[5] = 'untitled-5.jpg' thePictures[6] = 'untitled-6.jpg' thePictures[7] = 'untitled-7.jpg' thePictures[8] = 'untitled-8.jpg' thePictures[9] = 'untitled-9.jpg' thePictures[10] = 'untitled-10.jpg' thePictures[11] = 'untitled-11.jpg' thePictures[12] = 'untitled-12.jpg' thePictures[13] = 'untitled-13.jpg' thePictures[14] = 'untitled-14.jpg' thePictures[15] = 'untitled-15.jpg' thePictures[16] = 'untitled-16.jpg' thePictures[17] = 'untitled-17.jpg' thePictures[18] = 'untitled-18.jpg' thePictures[19] = 'untitled-19.jpg' thePictures[20] = 'untitled-20.jpg' thePictures[21] = 'untitled-21.jpg' thePictures[22] = 'untitled-22.jpg' thePictures[23] = 'untitled-23.jpg' thePictures[24] = 'untitled-24.jpg' thePictures[25] = 'untitled-25.jpg' thePictures[26] = 'untitled-26.jpg' thePictures[27] = 'untitled-27.jpg' thePictures[28] = 'untitled-28.jpg' thePictures[29] = 'untitled-29.jpg' thePictures[30] = 'untitled-30.jpg' thePictures[31] = 'untitled-31.jpg' thePictures[32] = 'untitled-32.jpg' thePictures[33] = 'untitled-33.jpg' thePictures[34] = 'untitled-34.jpg' thePictures[35] = 'untitled-35.jpg' thePictures[36] = 'untitled-36.jpg' thePictures[37] = 'untitled-37.jpg' thePictures[38] = 'untitled-38.jpg' thePictures[39] = 'untitled-39.jpg' thePictures[40] = 'untitled-40.jpg' thePictures[41] = 'untitled-41.jpg' thePictures[42] = 'untitled-42.jpg' thePictures[43] = 'untitled-43.jpg' thePictures[44] = 'untitled-44.jpg' thePictures[45] = 'untitled-45.jpg' thePictures[46] = 'untitled-46.jpg' thePictures[47] = 'untitled-47.jpg' thePictures[48] = 'untitled-48.jpg' thePictures[49] = 'untitled-49.jpg' thePictures[50] = 'untitled-50.jpg' thePictures[51] = 'untitled-51.jpg' thePictures[52] = 'untitled-52.jpg' thePictures[53] = 'untitled-53.jpg' thePictures[54] = 'untitled-54.jpg' thePictures[55] = 'untitled-55.jpg' thePictures[56] = 'untitled-56.jpg' thePictures[57] = 'untitled-57.jpg' thePictures[58] = 'untitled-58.jpg' thePictures[59] = 'untitled-59.jpg' thePictures[60] = 'untitled-60.jpg' thePictures[61] = 'untitled-61.jpg' thePictures[62] = 'untitled-62.jpg' thePictures[63] = 'untitled-63.jpg' thePictures[64] = 'untitled-64.jpg' thePictures[65] = 'untitled-65.jpg' thePictures[66] = 'untitled-66.jpg' thePictures[67] = 'untitled-67jpg' thePictures[68] = 'untitled-68.jpg' thePictures[69] = 'untitled-69.jpg' thePictures[70] = 'untitled-70.jpg' thePictures[71] = 'untitled-71.jpg' thePictures[72] = 'untitled-72.jpg' thePictures[73] = 'untitled-73.jpg' thePictures[74] = 'untitled-74.jpg' thePictures[75] = 'untitled-1.jpg' thePictures[76] = 'untitled-2.jpg' thePictures[77] = 'untitled-77.jpg' thePictures[78] = 'untitled-78.jpg' thePictures[79] = 'untitled-79.jpg' thePictures[80] = 'untitled-80.jpg' thePictures[81] = 'untitled-81.jpg' thePictures[82] = 'untitled-82.jpg' thePictures[83] = 'untitled-83.jpg' thePictures[84] = 'untitled-84.jpg' thePictures[85] = 'untitled-85.jpg' thePictures[86] = 'untitled-86.jpg' thePictures[87] = 'untitled-87.jpg' thePictures[88] = 'untitled-88.jpg' thePictures[89] = 'untitled-89.jpg' thePictures[90] = 'untitled-90.jpg' thePictures[91] = 'untitled-91.jpg' thePictures[92] = 'untitled-92.jpg' thePictures[93] = 'untitled-93.jpg' thePictures[94] = 'untitled-94.jpg' thePictures[95] = 'untitled-95.jpg' thePictures[96] = 'untitled-96.jpg' thePictures[97] = 'untitled-97.jpg' thePictures[98] = 'untitled-98.jpg' thePictures[99] = 'untitled-99.jpg' thePictures[100] = 'untitled-100.jpg' thePictures[101] = 'untitled-101.jpg' thePictures[102] = 'untitled-102.jpg' thePictures[103] = 'untitled-103.jpg' thePictures[104] = 'untitled-104.jpg' thePictures[105] = 'untitled-105.jpg' thePictures[106] = 'untitled-106.jpg' thePictures[107] = 'untitled-107.jpg' thePictures[108] = 'untitled-108.jpg' thePictures[109] = 'untitled-109.jpg' thePictures[110] = 'untitled-110.jpg' thePictures[111] = 'untitled-111.jpg' thePictures[112] = 'untitled-112.jpg' thePictures[113] = 'untitled-113.jpg' thePictures[114] = 'untitled-114.jpg' thePictures[115] = 'untitled-115.jpg' thePictures[116] = 'untitled-116.jpg' thePictures[117] = 'untitled-117.jpg' thePictures[118] = 'untitled-118.jpg' thePictures[119] = 'untitled-119.jpg' thePictures[120] = 'untitled-120.jpg' thePictures[121] = 'untitled-121.jpg' thePictures[122] = 'untitled-122.jpg' thePictures[123] = 'untitled-123.jpg' thePictures[124] = 'untitled-124.jpg' thePictures[125] = 'untitled-125.jpg' thePictures[126] = 'untitled-126.jpg' thePictures[127] = 'untitled-127.jpg' thePictures[128] = 'untitled-128.jpg' thePictures[129] = 'untitled-129.jpg' thePictures[130] = 'untitled-130.jpg' thePictures[131] = 'untitled-131.jpg' thePictures[132] = 'untitled-132.jpg' thePictures[133] = 'untitled-133.jpg' thePictures[134] = 'untitled-134.jpg' thePictures[135] = 'untitled-135.jpg' thePictures[136] = 'untitled-136.jpg' thePictures[137] = 'untitled-137.jpg' thePictures[138] = 'untitled-138.jpg' thePictures[139] = 'untitled-139.jpg' thePictures[140] = 'untitled-140.jpg' thePictures[141] = 'untitled-141.jpg' thePictures[142] = 'untitled-142.jpg' thePictures[143] = 'untitled-143.jpg' thePictures[144] = 'untitled-144.jpg' thePictures[145] = 'untitled-145.jpg' thePictures[146] = 'untitled-146.jpg' thePictures[147] = 'untitled-147.jpg' thePictures[148] = 'untitled-148.jpg' thePictures[149] = 'untitled-149.jpg' thePictures[150] = 'untitled-150.jpg' theImages[1] = 'untitled-1.jpg' theImages[2] = 'untitled-2.jpg' theImages[3] = 'untitled-3.jpg' theImages[4] = 'untitled-4.jpg' theImages[5] = 'untitled-5.jpg' theImages[6] = 'untitled-6.jpg' theImages[7] = 'untitled-7.jpg' theImages[8] = 'untitled-8.jpg' theImages[9] = 'untitled-9.jpg' theImages[10] = 'untitled-10.jpg' theImages[11] = 'untitled-11.jpg' theImages[12] = 'untitled-12.jpg' theImages[13] = 'untitled-13.jpg' theImages[14] = 'untitled-14.jpg' theImages[15] = 'untitled-15.jpg' theImages[16] = 'untitled-16.jpg' theImages[17] = 'untitled-17.jpg' theImages[18] = 'untitled-18.jpg' theImages[19] = 'untitled-19.jpg' theImages[20] = 'untitled-20.jpg' theImages[21] = 'untitled-21.jpg' theImages[22] = 'untitled-22.jpg' theImages[23] = 'untitled-23.jpg' theImages[24] = 'untitled-24.jpg' theImages[25] = 'untitled-25.jpg' theImages[26] = 'untitled-26.jpg' theImages[27] = 'untitled-27.jpg' theImages[28] = 'untitled-28.jpg' theImages[29] = 'untitled-29.jpg' theImages[30] = 'untitled-30.jpg' theImages[31] = 'untitled-31.jpg' theImages[32] = 'untitled-32.jpg' theImages[33] = 'untitled-33.jpg' theImages[34] = 'untitled-34.jpg' theImages[35] = 'untitled-35.jpg' theImages[36] = 'untitled-36.jpg' theImages[37] = 'untitled-37.jpg' theImages[38] = 'untitled-38.jpg' theImages[39] = 'untitled-39.jpg' theImages[40] = 'untitled-40.jpg' theImages[41] = 'untitled-41.jpg' theImages[42] = 'untitled-42.jpg' theImages[43] = 'untitled-43.jpg' theImages[44] = 'untitled-44.jpg' theImages[45] = 'untitled-45.jpg' theImages[46] = 'untitled-46.jpg' theImages[47] = 'untitled-47.jpg' theImages[48] = 'untitled-48.jpg' theImages[49] = 'untitled-49.jpg' theImages[50] = 'untitled-50.jpg' theImages[51] = 'untitled-51.jpg' theImages[52] = 'untitled-52.jpg' theImages[53] = 'untitled-53.jpg' theImages[54] = 'untitled-54.jpg' theImages[55] = 'untitled-55.jpg' theImages[56] = 'untitled-56.jpg' theImages[57] = 'untitled-57.jpg' theImages[58] = 'untitled-58.jpg' theImages[59] = 'untitled-59.jpg' theImages[60] = 'untitled-60.jpg' theImages[61] = 'untitled-61.jpg' theImages[62] = 'untitled-62.jpg' theImages[63] = 'untitled-63.jpg' theImages[64] = 'untitled-64.jpg' theImages[65] = 'untitled-65.jpg' theImages[66] = 'untitled-66.jpg' theImages[67] = 'untitled-67.jpg' theImages[68] = 'untitled-68.jpg' theImages[69] = 'untitled-69.jpg' theImages[70] = 'untitled-70.jpg' theImages[71] = 'untitled-71.jpg' theImages[72] = 'untitled-72.jpg' theImages[73] = 'untitled-73.jpg' theImages[74] = 'untitled-74.jpg' theImages[75] = 'untitled-75.jpg' theImages[76] = 'untitled-76.jpg' theImages[77] = 'untitled-77.jpg' theImages[78] = 'untitled-78.jpg' theImages[79] = 'untitled-79.jpg' theImages[80] = 'untitled-80.jpg' theImages[81] = 'untitled-81.jpg' theImages[82] = 'untitled-82.jpg' theImages[83] = 'untitled-83.jpg' theImages[84] = 'untitled-84.jpg' theImages[85] = 'untitled-85.jpg' theImages[86] = 'untitled-86.jpg' theImages[87] = 'untitled-87.jpg' theImages[88] = 'untitled-88.jpg' theImages[89] = 'untitled-89.jpg' theImages[90] = 'untitled-90.jpg' theImages[91] = 'untitled-91.jpg' theImages[92] = 'untitled-92.jpg' theImages[93] = 'untitled-93.jpg' theImages[94] = 'untitled-94.jpg' theImages[95] = 'untitled-95.jpg' theImages[96] = 'untitled-96.jpg' theImages[97] = 'untitled-97.jpg' theImages[98] = 'untitled-98.jpg' theImages[99] = 'untitled-99.jpg' theImages[100] = 'untitled-100.jpg' theImages[101] = 'untitled-101.jpg' theImages[102] = 'untitled-102.jpg' theImages[103] = 'untitled-103.jpg' theImages[104] = 'untitled-104.jpg' theImages[105] = 'untitled-105.jpg' theImages[106] = 'untitled-106.jpg' theImages[107] = 'untitled-107.jpg' theImages[108] = 'untitled-108.jpg' theImages[109] = 'untitled-109.jpg' theImages[110] = 'untitled-110.jpg' theImages[111] = 'untitled-111.jpg' theImages[112] = 'untitled-112.jpg' theImages[113] = 'untitled-113.jpg' theImages[114] = 'untitled-114.jpg' theImages[115] = 'untitled-115.jpg' theImages[116] = 'untitled-116.jpg' theImages[117] = 'untitled-117.jpg' theImages[118] = 'untitled-118.jpg' theImages[119] = 'untitled-119.jpg' theImages[120] = 'untitled-120.jpg' theImages[121] = 'untitled-121.jpg' theImages[122] = 'untitled-122.jpg' theImages[123] = 'untitled-123.jpg' theImages[124] = 'untitled-124.jpg' theImages[125] = 'untitled-125.jpg' theImages[126] = 'untitled-126.jpg' theImages[127] = 'untitled-127.jpg' theImages[128] = 'untitled-128.jpg' theImages[129] = 'untitled-129.jpg' theImages[130] = 'untitled-130.jpg' theImages[131] = 'untitled-131.jpg' theImages[132] = 'untitled-132.jpg' theImages[133] = 'untitled-133.jpg' theImages[134] = 'untitled-134.jpg' theImages[135] = 'untitled-135.jpg' theImages[136] = 'untitled-136.jpg' theImages[137] = 'untitled-137.jpg' theImages[138] = 'untitled-138.jpg' theImages[139] = 'untitled-139.jpg' theImages[140] = 'untitled-140.jpg' theImages[141] = 'untitled-141.jpg' theImages[142] = 'untitled-142.jpg' theImages[143] = 'untitled-143.jpg' theImages[144] = 'untitled-144.jpg' theImages[145] = 'untitled-145.jpg' theImages[146] = 'untitled-146.jpg' theImages[147] = 'untitled-147.jpg' theImages[148] = 'untitled-148.jpg' theImages[149] = 'untitled-149.jpg' theImages[150] = 'untitled-150.jpg' var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'">'); } var j = 0 var p = thePictures.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = thePictures[i] } var whichPicture = Math.round(Math.random()*(p-1)); function showPicture(){ document.write('<img src="'+thePictures[whichPicture]+'"align = right >'); } // End --> </script> </head> <body> <script language="JavaScript"> showImage(); </script> <script language="JavaScript"> showPicture(); </script> <h4 align = center> Click Left or Right arrow key to select which one is better. </h4> </body> </html> It's a sort of mad lib. I have written codes for both windows. I just don't know what code to write in, or outside the tellStory function to display the actual story once the other window is called open.... <html> <head> <title>Silly Storey About You</title> </head> <script> function tellStorey() { setupStoryWindow(); } function setupStoryWindow(name, contentString) { var header = "<head><title>" + name + " 's story</title><head>" + "<h1>" + name + " 's story</h1>"; var storyWindow = window.open('', 'storyWindow'); storyWindow.document.write(header); storyWindow.document.write(contentString); storyWindow.document.close(); storyWindow.focus(); } </script> <body> <h1>Tell Your Storey</h1> <form name="input" method="get"> <p>Your first name: <input type="text" name="yourFirstName" /></p> <p>Your gender: <select name=yourGenderList> <option value="girl">girl <option value="guy">guy </select></p> <p>City you'd like to visit some day: <input type="text" name="city"/></p> <p>A fruit (plural form): <input type="text" name="fruit"/></p> <p>Your favorite teacher's name: <input type="text" name="teacher" /></p> <p>Your best friend's name: <input type="text" name="friend" /></p> <p>Your favorite actor's name: <input type="text" name="actor" /></p> <p>A large animal: <input type="text" name="animal" /></p> <p><input type=button value="Tell a Storey" onclick='tellStorey();'</p> </form> </body> </html> //here's the story "One fine morning on valentine's day a" + yourGenderList + "named" + yourFirstName + "woke up so excited. For today was going to be a single's date night in" + city + ", which is well known for "+ fruit + "." + name + "'s friend" + friend + "recommended that I go because they ended up, curiously enough, meeting and marrying my high school teacher" + teacher + ". I'm just hoping to meet someone that looks like" + actor + ". I've had a crush on"+ actor + "for too many years now. Well, realistically, that probably won't happen, but as long as they look like a" + animal + ", then my night will be worth while!" Help with JavaScript in HTML? Okay, I have done everything that I can to try and figure this one out...I am stumped. I need to display the flag of the specific country when the radio button of that flag is clicked. The book states: Create a Web Page that contains a table with two columns in a single row. In the first column, create a list of radio buttons that contains the name of each of the 10 countries. In the second column, display the flag of the selected country in an anchor element. Use onclick even handlers to display the flag image for each selected country. When the page first loads, the image should be blank. Here is my code: Code: <!DOCTYPE HTML> <!--My Name--> <!--Chapter 8 Page 478--> <!--October 28, 2011--> <html> <head> <title>Country Flags</title> <script type="text/javascript"> /* <![CDATA[ */ var argentina = "argentina.jpg" var australia = "australia.jpg" var bolivia = "bolivia.jpg" var cuba = "cuba.jpg" var finland = "finland.jpg" var france = "france.jpg" var italy = "italy.jpg" var peru = "peru.jpg" var syria = "syria.jpg" var tunisia = "tunisia.jpg" /* ]] */ </script> </head> <body> <form name="flags" action=" " method="get"> <table style="border: 1; width: 100%"> <tr valign="top"> <td> <input type="radio" name="flags" onclick= "document.argentina.jpg" /> Argentina <input type="radio" name="flags" onclick= "document.flags.country.value=austra… /> Australia <input type="radio" name="flags" onclick= "document.flags.country.value=bolivi… /> Bolivia <input type="radio" name="flags" onclick= "document.flags.country.value=cuba" /> Cuba <input type="radio" name="flags" onclick= "document.flags.country.value=finlan… /> Finland <input type="radio" name="flags" onclick= "document.flags.country.value=france… /> France <input type="radio" name="flags" onclick= "document.flags.country.value=italy" /> Italy <input type="radio" name="flags" onclick= "document.flags.country.value=peru" /> Peru <input type="radio" name="flags" onclick= "document.flags.country.value=syria" /> Syria <input type="radio" name="flags" onclick= "document.flags.country.value=tunisi… /> Tunisia </td> </p> <td> <textarea name="country" cols="75" rows="20" style="background-color: Transparent; border: none; overflow: hidden"></textarea> </td> </tr> </table> </form> </p> </body> </html> Can someone please help me out here. Thanks ok, quick and to the point. I have this... Code: <a href="www.mylink.com" class="myclass">click</a> and I wanna change it to a javascript function that can be called via the SAME tag, but with this link: Code: <a href="javascript: myfunction()">click</a> Here's what i have so far: Code: <head> <script type="text/javascript"> function myfunction() { window.location.href='www.mylink.com'; } </script> </head> <body> <a href="javascript: myfunction()">click</a> </body> this works to the point where it only opens the link, but now i can't figure out how to add the class to it. I tried adding it inside the body tag, but it doesn't work. So, I'm wondering if it's possible to set the class in the javascript. Thanks in advance for the help, I really appreciate it Hey guys, I use a newsletter service called Aweber to handle my blog's subscription service. What I have right now is a simple HTML form that I can have pass its variables through to a thank you page, so I can add customization there. The web form looks like this: Name: ________________ Email: ________________ Choose a free gift!: drop down list with "gift1" "gift2" or "gift3" as the choices. When a user submits the form, it will bring them to a custom thank you page, which I have made as "thank-you.php". On the "thank you" page, there is a javascript code that was given by Aweber which basically loads up all the variables... you can then CALL all of the variables in the page like this: <script type="text/javascript">formData.display("name")</script> ========================== So what's my question? I wanted there to be a display on the bottom that would allow users to download a different gift based on whether they chose gift 1, 2 or 3. I would also love to have there be an image of the ebook next to the download link depending on which book they chose. Is there a way I can pass variables through into an html <img> tag? (i.e. src="http://www.website.com/formData.display("gift").jpg" ... or something like that). Building off this, how would I generate a different download link based on the choice they made in the web form? (i.e. <a href="http://www.website.com/formData.display("gift").pdf"> or similar) Hopefully this all makes sense, let me know if you can help! I'm trying to include an HTML/CSS Navigation Bar in a JavaScript file for easy editing (instead of going from page to page changing the same thing). This is the HTML & CSS I want to include in the JavaScript file: <a style="border-left: 1px solid white; padding: 5px" class=menu href="Index.html" title="Home"> Home</a><a class=menu href="menu1.html" title="Portfolio"> Portfolio</a><a class=menu href="menu2.html" title="About Us"> About Us</a><a class=menu href="menu3.html" title="Media"> Media</a><a class=menu href="menu4.html" title="Store"> Store</a><a class=menu href="menu5.html" title="Contact Us"> Contact Us</a> -If this isn't possible to do in JavaScript, then what language can I do it in? Thank you for reading. Hi I am a total newbie to javascript and css and have a menu that I am trying to get to work. Also in the attachments the on.png need's to go in the images folder (Flyout menu.zip/Flyout menu/images/) To start I downloaded a template that I liked. But I have a problem because if you look at the attached html page (you need to download all of them to get it to work) when you move your mouse over a menu item that has an '>' it expands with a submenu. The problem is that when you move your mouse onto one of the submenu items the main item that it came from doesn't stay lit up which makes it hard to tell which one you came from (I also think that it doesn't look good). If anyone can edit/add to the java/css/html files and make it work I will be very happy (I have been trying for days now). Another minor problem probably to do with the css is that I would like the arrows (currently they are just text greater than signs '>') to be images and aligned right and the text to stay aligned left. Thanks for any help I have a multibox in one of my JSP's that I want to manipulate via JavaScript, and have one of the checkboxes selected. The multibox property is "allChoices" in JavaScript, how do I check the first checkbox in the multibox? The code I have now does not seem to be working: Code: var choice1 = document.getElementById("allChoices[0]"); choice1.checked = true; I just have a quick question.... Is it possible to use Javascript to set the name of a tag to be the tag's id? For example, something like this: Code: <input type="text" id="textInput" name="this.id"> The example code above doesn't work. The reason I'm asking is because I have a complex form that uses Javascript to change ids a lot (the input fields are dynamically created). When I was coding the form I completely overlooked the fact I need to use the name tag to process it with PHP. (to enter it into a mysql database) It'd be a pain to have to go through all my javascript and change the name where ever I change the ids. If need be, I'll do this, but I'm just looking for an easier way. Thanks in advance! Please see the below code. Is it possible for me to type in an order date in the browser & in the due date field, have it automatically populate a date 7 days greater than the date typed in the order date field? If so how? I have read I will probably need javascript to do this but have no clue where to start. Thanks for any help provided! <html> <head> <title> Update Database </title> </head> <body> <form method="post" action="add.php"> <b>First Name:</b> <br /> <input type="text" name="customer_fname" size="35" /><br /> <b>Last Name:</b> <br /> <input type="text" name="customer_lname" size="35" /><br /> <b>Location:</b> <br /> <input type="text" name="location" size="35" /><br /> <b>Order Date:</b> <br /> <input type="text" name="order_date" size="35" /><br /> <b>Due Date:</b> <br /> <input type="text" name="due_date" size="35" /><br /> <input type="submit" value="Submit" /> </form> </body> </html> I am building a portion of html in a javascript loop. Everything is working great except for the function call I am trying to build inside the div. The resulting html when rendered in a page looks like Code: <div onclick="ShowMyPopupSetRead(" a','a','a','a')=""><u style="color: blue; cursor: pointer"> Hello </u></div> you can see the quotation in the beginning of the function call throws the whole thing off. Below you can see how I am building the string. Code: var assembledCall = "onclick='ShowMyPopupSetRead('" + subject + "','" + sender + "','" + reciever + "','" + id + "')";$('#MailTable').append("<div " + assembledCall + "><u style='color: blue; cursor: pointer'> " + subject + " </u></div>"); can any one see where my problem is? hi i am having an issue with javascript on my web site. i am a complete noob at this. the objective is to have the page pop up an alert any time the submit button is pressed: 1st if there is no name on the form the alert says "please enter you first name" and returns a false value to the from 2nd if there is a name on the form the alert is supposed to have a thank you message my problem is that it doesn't show the alert when there is a name here is the code Code: <head> <script type="text/javascript> function write(person) { alert("Thank you for conacting us, "+person+"!"); } function formgo() { var name=document.getElementById('namein').value; if (name==null || name=="") { alert("Please enter your name"); return false; } writety(name); document.forms('contact').reset(); } </script> </head> <body> <form> <fieldset id="contactinfo"> <legend>Contact Details</legend> <label> Name <input type="text" name="name" id="namein" placeholder="First and Last name" /> </label> </fieldset> <fieldset id="submitbox"> <input type="submit" id="submit" value="Submit" onclick='formgo()' /> </fieldset> </form> </body> please reply or email me thank you -misstam I'm trying to display the elements in an array but doesn't seem to work: Code: var myurl=new Array("google.com", "yahoo.com"); for (i=0;i<=myurl.length-1;i++){ document.writeln("<a href='http://www.' + myurl[i] + target='_blank'>"); } Not sure why it is not working?? Hi everyone, I am new to javascript, i have not read any books, but i am trying to figure out the language on the go. I am stuck with a simple program that i am trying to create for a class project. Any suggestions or help would much appreciated. My code is very simple in which i would like to convert a number value into different format of temperature. My code is listed below, it is not working in the browser. Help me fix it. ********************************************************* <!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 content="text/html" http-equiv="Content-Type" /> <title>E6B temp conversion</title> <script type="text/javascript"> function ConvertTempToC(TempConversionC) { var temperature = TempConversionC.F.value; if (temperature.length > 0) { TempConversionC.TempC.value = Math.round(5/9 * (temperature - 32)); document.write(TempConversionC.TempC.value); } } </script> </head> <body> <b>Fahrenheit to Celsius</b> <br/> <input size="6" name="F"/> <br/> <input onclick="ConvertTempToC(this.form)" value="Calculate Celsius" type="button" name="Submit11"/> <br/> <input readonly="readonly" size="6" name="TempC"/> </body> </html> Hey guys, I've never use JavaScript before so bare with me. But, I have a registration form, and I want to have a location field in it, and then a region field that changes depending on what the user set as their location. But, I cannot get it to work, and I have no idea of how to go about doing it. Here is the JavaScript I have been using so far: Code: function toggleTable(select) { if(select.value == "uk") { select.value = "uk"; document.getElementById("region2").style.visibility = "collapse"; document.getElementById("region1").style.visibility = "visible"; } else if(select.value == "usa") { select.value = "usa"; document.getElementById("region1").style.visibility = "collapse"; document.getElementById("region2").style.visibility = "visible"; } } and it does show the right region depending on what the user inputed, but when the page loads, all the fields show up until the user click on the location field, here is the code for that so you can test it out: Code: <tr><td>Location: </td><td><select name="location" onclick="toggleTable(this);"> <option value="none">Please Select One</option> <option value="uk">UK</option> <option value="usa">USA</option> </select></td></tr> <tr id="region1"><td>Region: </td><td> <select name="region"> <option value="uk1">uk1</option> <option value="uk2">uk2</option> </select></td></tr> <tr id="region2"><td>Region: </td><td> <select name="region"> <option value="usa1">usa1</option> <option value="usa2">usa2</option> </select> </td></tr> Any help at all please? hey guys, just wondering if u could help me out i'm writing a form for ordering pizza and i'm using a button to submit the info with an onclick event handler. for some reason it won't call the function that i want it to when the submit button is click. here is the code any idea what i'm doing wrong???? <html> <body> <form name="form1" action="popup" method="get"> <fieldset> <legend>Pizza Order form</legend> <p>Write in a First name</P> <input type="text" size="20" maxlength="50" name="firstName"></p> <p>Write in a last name (or surname):<br> <input type="text" size="20" maxlength="50" name="surName"></p> <p>Write in an email address:<br> <input type="text" size ="20" maxlegth="50 name="address"> <p>Are you a previous customer?:<br> <select name="precust"> <option selected>- - - - - - Select one - - - - - -</option> <option value="Yes">Yes</option> <option value="No">No</option> </select></p> <p>pickup or delivery:<br> <select name="delivery"> <option selected>- - - - - - Select one - - - - - -</option> <option value="pickup">pickup</option> <option value="dilivery">delivery</option> </select></p> <p>size:<br> <select name="size"> <option selected>- - - - - - Select one - - - - - -</option> <option value="small">small</option> <option value="medium">medium</option> <option value="large">large</option> <option value="XL">extra large</option> </select></p> <p>number of pizzas:<br> <select name="num"> <option selected>- - - - - - Select one - - - - - -</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></p> <p>Toppings:<br> Bacon <input type="checkbox" name="bacon" value="bacon"><br> extra cheese <input type="checkbox" name="xcheese" value="extra cheese"><br> olives<input type="checkbox" name="olives" value="olives"><br> pepperoni<input type="checkbox" name="pepperoni" value="pepperoni"><br> mushrooms<input type="checkbox" name="mushrooms" value="mushrooms"><br> green pepper<input type="checkbox" name="gpepper" value="green pepper"><br> red pepper<input type="checkbox" name="rpepper" value="redpepper"><br> sausage <input type="checkbox" name="sausage" value="sausage"><br> ham<input type="checkbox" name="ham" value="ham"><br> pineapple<input type="checkbox" name="pineapple" value="pineapple"><br><br> <input type=button name="hawaiian" value="hawaiian" onclick=' document.form1.ham.checked = true; document.form1.mushrooms.checked = true; document.form1.pineapple.checked = true; document.form1.bacon.checked = false; document.form1.gpepper.checked = false; document.form1.rpepper.checked = false; document.form1.olives.checked = false; document.form1.pepperoni.checked = false; document.form1.sausage.checked = false; document.form1.xchees.checked = false; '> <input type=button name="meatlovers" value="meatlovers" onclick=' document.form1.ham.checked = false; document.form1.mushrooms.checked = false; document.form1.pineapple.checked = true; document.form1.bacon.checked = false; document.form1.gpepper.checked = true; document.form1.rpepper.checked = true; document.form1.olives.checked = true; document.form1.pepperoni.checked = false; document.form1.sausage.checked = false; document.form1.xcheese.checked = false; '> <input type=button name="vegetarian" value="vegetarian" onclick=' document.form1.ham.checked = true; document.form1.mushrooms.checked = false; document.form1.pineapple.checked = false; document.form1.bacon.checked = true; document.form1.gpepper.checked = false; document.form1.rpepper.checked = false; document.form1.olives = "unchecked" document.form1.pepperoni.checked = true; document.form1.sausage.checked = true; document.form1.xcheese.checked = false'> <p><input type=button name="submit" value="Submit" onclick='submit()'></p> </fieldset> </form> <script type="text/javascript" language="Javascript" > function submit() { var fname = document.form1.firstname.value; var lname = document.form1.surname.value; var address = document.form1.address.value; var size = document.form1.size.value; var num = document.form1.num.value; var delivery = document.form1.delivery.value; var precust = document.form1.precust.value; var price; var message; if(document.form1.size.value == "small"){price=5} if(document.form1.size.value == "medium"){price=8} if(document.form1.size.value == "large"){price=10} if(document.form1.size.value == "XL"){price=13} price = price * num; if(document.form1.precust.value == "yes"){price=price*0.9} if(document.form1.delivery.value == "delivery"){price=price+4} message = "Thank you " + fname + " " + lname; message += "You ordered " + document.form1.num.value + " " + document.form1.size.value + " pizzas. "; message += "Your total price is $" + price; var r=confirm(message);// displays the message in a pop-up return(1); } </script> </html> |