HTML - Output Disappear After Successful Running Of Javascript
//Html code
<html> <head> <script language="javascript"> function abc() { var fname=document.myform.fno.value; if(fname==""||fname==null) { alert("Name Field is blank"); return false; } output(); } function output() { alert("Output Section"); var name=document.myform.fno.value; document.getElementById('name').innerHTML=name; var vehobj=document.myform.vehicle; var vehchecked=[]; var numberofoptions=vehobj.length; for(k=0;k<numberofoptions;k++) { if(vehobj[k].selected==true) { vehchecked[k]=vehobj[k].value; } } var vehicles=vehchecked.join(" "); document.getElementById('veh').innerHTML=vehicles; var fruity=document.myform.fruit; var fru=[]; var fruit_total=""; for( i=0;i<fruity.length;i++) { if(fruity[i].type=="checkbox") { if(fruity[i].checked) { //fru.push(fruity[i].value); fruit_total+=fruity[i].value+" "; } } } document.getElementById('fruity').innerHTML=fruit_total; alert("Ends"); } </script> </head> <body> <form name="myform" onsubmit=" return abc()"> <br><br><br><br><br><br> Name : <input type="text" name="fno" maxlength=20/><br><br> Phone Number :<input type="text" name="pno" maxlength=10/><br><br> Email : <input type="text" name="email" maxlength=20/> Address : <textarea name="address" maxlength=200></textarea> <br><br> Vehicle: <select name="vehicle" multiple="multiple"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> <br><br> Fruits you like<br> Mango:<input type="checkbox" name="fruit" value="mango"><br> Grapes:<input type="checkbox" name="fruit" value="grapes"><br> Apple:<input type="checkbox" name="fruit" value="apple"><br><br> <input type="submit" value="submit" /> </form> <br><br><!-- Click to get output<input type="button" value="Click" onclick="output()"/> --> <h2>Output</h2> Name : <b id="name"></b><br> Phone Number :<b>8825247455</b><br> Email :<b>y_j@gmail.com</b><br> Address :<b>Akshay Flat no 22,Linking road,Mumbai</b><br> Vehicle :<b id="veh"></b><br> Fruits :<b id="fruity"></b><br> </body> </html> ************************************************* I am learning javascript this is just a practicing code. What i want is as soon as validation part is over next function must be called up and o/p must be printed at the ends. It works but as final line of output method executes the data disappear from output. Please help me to resolve this issue. Similar TutorialsHi I hope you can help me. The problem is only in explorer 9 and only if you choose "use not recommended settings" when explorer 9 starts for the first time. Both my menu, parts of the logo and a lot of other texts disappears. www.nordicwebdesign.dk Hello everyone! I have a quick questions that I cannot figure out the past few months. I have a website for the private school I work at and we have our webpage set up mostly using Dreamweaver with .html pages and Dreamweaver templates. Here's my question: When links on the top dropdown menu bars are clicked, they disappear when you go back and look, they are still there, but just not visisble until I reset the browser cookies and history. Any ideas??? BTW, the website is www.scrantonprep.com If you use the dropdown menus up top and click on something, you will then see that when you go back or access the site again, the one you clicked on disappears. Any help with this matter would GREATLY be appreaciated!! I am not sure if this goes here or not but here it goes. I have a image I created in Fireworks and it is png but I have tried this as jpg. Anyways, the image as a border around it and I am not sure why and why I can not get rid of it. ON fireworks it doesn't show a border but it does on the site and don't know why. Here is the code for the image. Code: <img src="images/contestHeader.png" border="0" width="570" alt="2008 Sarazen Dr Decorating Contest" /> Here is the page for the image. http://www.mesquitechristmas.com/contest.html Anyone have an idea why this is happening? BTW I am using FF -Thanks Hey guys, I was wondering if there was a possible way to make a link disapppear after it is clicked, and for it to stay that way until the link is changed. Help? Thanks Greetings, My menus will function on my firefox browser but not in IE or Safari. Check it here... i am thinking it is a problem with css/js..... couldn't tell you any help? dmrosemark.com Thanks in advance I would like to have some text and/or image appear on a page. And at a date/time have it disappear/expire. Is this possible? Is it html or a script? Any direction would help THANKS! Dave hi, sometimes the top part of my website disappears... When I restart Fiirefox the problem is solved. If refresh the page it... the problem is still there... thanks Hey, I recently logged onto my old Piczo site which I used to store pictures on( The site domain being; http://www.badboypicturessss.piczo.com/?cr=1 ) . After logging in I discoverd no images show. Just a red cross upon the corner (I've tried to view on Firefox and Internet Explorer) When clicking propeties on the picture and entering into the Firefox html I am met with, This XML file does not appear to have any style information associated with it. The document tree is shown below. − <Error> <Code>AccessDenied</Code> <Message>Access Denied</Message> <RequestId>4B0C38630330B989</RequestId> − <HostId> 0hsgiTfM+6zl+X127uhukEZM6SYj0D+HCeYk113cG8ftnK0AM5 knte5VpiqDEKo4 </HostId> </Error> Am running out of ideas of how to get the images to show, I've tried numerous forums seeking the answer to how to display the images! Thanks for reading, be great if you could help! Hey guys, I'm new here, and still somewhat of a noob when it comes to html and web design so be easy on me. One of my new projects is creditcardrewardzone.com, which I thought was looking pretty good until someone told me that it was completely screwed up when they looked at it in Internet Explorer on their windows machine. I myself work on a mac and check it with safari, firefox, and IE, and everything looks fine, but for some reason in IE on windows, the tables run really long to the point where the site isn't functional. If you go to the site and click on cash cards, you can see what I mean. Can anybody look at my code and see if there's something I'm doing wrong? Thanks a lot, I look forward to staying at the forum and probably asking a lot more questions! Josh Im hosting my own web page with Apache and im not using a domain but i cant find the ip or anything that i would use to get to the address. Please help and thanks. Hello, First off, I'd like you to forgive any and all misconceptions I may have/make in this, as I know as little as possible about html for me to actually post this. Currently I have open the source of a website, (let's call it Site), and in this code I have narrowed down the script (function?) that is called when you click on a button (Button). Is it possible for me to somehow use the source code to call this function/script, simulating the button being pressed? I plan to make a "simple" program to move through Site as a project/practice and this is the point I'm starting at. Gotta start somewhere. Thanks, paradigm <?php for ( $counter = 0; $counter <= 10; $counter += 1) { echo "Hello World<br>"; } ?> hi im designing a we site by php i have a html form that collect some information from client an it has some script for hide or visible text box when user check a checkbox but when client run my page see a popup menu allowed blocked content.... i saw some site do this withou running this popup how can i do it? thanks <HTML> <HEAD> <TITLE> Jogging Summary </TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="tma03.css"> <SCRIPT LANGUAGE = "JavaScript"> //days of the week var dayArray = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri','Sat', 'Sun']; //date of a sample week var weekBeginning = '12 July 2010' //distance in kilometres run each day in the sample week var distanceArray = [2,4,2,1,5,4,3]; //Part (i) //Add code to display a heading, then a blank line, // then the information for each of the seven days. document.write('Summary for week beginning 12 July 2010'+ '<BR>'); document.write('<BR>'); for (var day = 6; day < dayArray.length; day = day +1 ) { document.write('Mon ' + - + '2'+ 'km' + '<BR>'); document.write('Tue ' + - + '4'+ 'km' + '<BR>'); document.write('Wed ' + - + '2'+ 'km' + '<BR>'); document.write('Thu ' + - + '1'+ 'km' + '<BR>'); document.write('Fri ' + - + '5'+ 'km' + '<BR>'); document.write('Sat ' + - + '4'+ 'km' + '<BR>'); document.write('Sun ' + - + '3'+ 'kn' + '<BR>'); document.write('<BR>'); } //Variable to hold the maximum value in distance array. var maximumDistance; //Part (ii) //Add code to find the maximum distance. maximumDistanceindex = 0; for (var distance = 0;distance<distanceArray.length ; distance = distance + 1 ) { if (distanceArray[day] > distanceArray[maximumDistanceindex]) { maximumDistanceindex = day; } } //Part (iv) //Add code that will write out the maximum distance and the days it was run on in a suitable message. document.write('The maximum distance was '+ maximumDistanceindex + ' km ' + 'run on ' + dayArray[maximumDistanceindex]); </SCRIPT> </HEAD> <BODY> </BODY> </HTML> Can anyone help me with this i can not find out how to output the correct maximum distance please? think i've cracked it. <HTML> <HEAD> <TITLE> Jogging Summary </TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="tma03.css"> <SCRIPT LANGUAGE = "JavaScript"> /* * M150 TMA03 2010J Q3. * Program to analyse the distances run by a jogger each day over the course of a week. */ //days of the week var dayArray = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri','Sat', 'Sun']; //date of a sample week var weekBeginning = '12 July 2010' //distance in kilometres run each day in the sample week var distanceArray = [2,4,2,1,5,4,3]; //second sample week //Part (v) uncomment the next two lines. //weekBeginning = '19 July 2010' //distanceArray = [2,6,3,1,6,4,2]; //Part (i) //Add code to display a heading, then a blank line, // then the information for each of the seven days. document.write('Summary for week beginning '+ weekBeginning + '<BR>'); document.write('<BR>'); for (var day = 6; day < dayArray.length; day = day +1 ) { document.write('Mon ' + - + '2'+ 'km' + '<BR>'); document.write('Tue ' + - + '4'+ 'km' + '<BR>'); document.write('Wed ' + - + '2'+ 'km' + '<BR>'); document.write('Thu ' + - + '1'+ 'km' + '<BR>'); document.write('Fri ' + - + '5'+ 'km' + '<BR>'); document.write('Sat ' + - + '4'+ 'km' + '<BR>'); document.write('Sun ' + - + '3'+ 'kn' + '<BR>'); document.write('<BR>'); } //Variable to hold the maximum value in distance array. var maximumDistance; //Part (ii) //Add code to find the maximum distance. maximumDistance = distanceArray[0]; for (var day = 1; day < distanceArray.length ; day = day + 1 ) { if (distanceArray[day] > distanceArray[maximumDistance]) { maximumDistance = day; } } //Part (iv) //Add code that will write out the maximum distance and the days it was run on in a suitable message. document.write('The maximum distance was '+ distanceArray[maximumDistance] + ' km ' + 'run on ' + dayArray[maximumDistance]); </SCRIPT> </HEAD> <BODY> </BODY> </HTML> Seems to work mostly anyway. I don't know what is going wrong with this code. Showing well formatted in IE but not in firefox <ol start="1" style="font-size: 10pt; font-family: Arial; margin-left:50px; " type="1"> <li> <p style="font-size: 10pt; font-family: Arial; margin-left: 50px;padding-left:-5px;">text1 </li> <li> <p style="font-size: 10pt; font-family: Arial; margin-left: 50px;">text2</li> <li><p style="font-size: 10pt; font-family: Arial; margin-left: 50px;"> text3</li> </ol> I have a form where a user makes selections from selection lists. As they make selections a counter displayed in the form keeps them up to date with how many selection they have made. To display this counter I have been using an input box as follows; <input type="text" id="counter" name="counter" value="0" size="2" /> A JavaScript function updates the value of this input box every time the user makes another selection from any selection list on the form. The JavaScript funtion is called from the selection lists' attribute declaration as follows; onchange="calllFunction()" However I feel the input box is not the right element to use to display the counter's value. An input box does the job but it allows the user to enter stuff in it, and I don't want this to be allowed. Any suggestions? I am using PHP to generate the headers to output a PDF file. The PDF file on every browser (IE, FF, Saf) exports with no content (0 bytes) whether it is opened or saved. This works correctly on my local development machine, but not on the actual server. The server requires credentials to access it, so I can't provide a link for demonstration. <? if( $format == 'csv' ) { header( 'Content-type: text/csv' ); header( "Content-Disposition: attachment; filename=\"Report Export.csv\"" ); include "userfiles/$loginid.csv"; } if( $format == 'pdf' ) { header( 'Content-type: application/pdf' ); header( "Content-Disposition: attachment; filename=\"Report Export.pdf\"" ); include "userfiles/$loginid.pdf"; } ?> Basically the referring page determines what format the user is requesting. "$loginid" is a cookie with the user's ID, so the system can locate that users specific file in the 'userfiles' directory. The CSV outputs perfectly. (exact same code with respective formats changed) I've validated that the PDF file is in the directory and does have content. The PDF content does export to file when attached to an email sent by the server. Any help is appreciated. I have a theory this may be an issue with the server configuration... Hello All, I'm working in SAP . I've a HTML File in my SAP Server. The content of that file is in Spanish. When I see the output of it from my SAP Server it's correct. But when I import that file in my SAP ABAP Program and then chk the output then I'm getting some junk values in it. I guess this is a UNICODE Problem. Request you guys to help me out ! Regards, Sandy. Hi Can someone help or advise me I am after a piece of code that will show a search box, which will display two different results depending on what is entered into the search. If someone was to enter one of my selected keywords a successful message appears. But if any other word is enter a nun-successful message appears. I think what i am after is some kind of "form"?? but have search lots of sites with little success. The search does Not need to email or add information to any files, just dispaly a succsessfull or un-successful message result. thanks Hi Guys, I am building a website for a client, and I have included a contact form on the website. It turns out that they would prefer it if the form could be printed out instead of emailed. All I have is 3 fields, and I want them to output to a page where they can print directly. The design of the output page will be minimal as in the end the forms will be faxed to a number. Is there some way I can do this with HTML? Or is advanced language needed? Cheers LTC |