JavaScript - 2 Input File Types Need Same Value
Similar TutorialsHello, I am trying to add radio buttons in this quiz script that i'm using, but when i change the drop down box to radio buttons the quiz script stops working, i.e it will not calculate the correct answers / percentage. I dont think i am correctly adding the input type "radio" and the script cannot recognise the value properly as i'am trying to make custom radio buttons from javascript / css. here is the script thats stopped working but how do i make the radio buttons send the correct value to the quiz script? Hope someone can help, i can add the css file if need be.. Code: <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=yes;" /> <TITLE>Seventies Trivia Quizzes & Games</TITLE> <link rel="stylesheet" type="text/css" href="style.css" /> <script language=Javascript> <!-- function stopErrors(){ return true; } window.onerror=stopErrors; // --> </script> <script language="JavaScript1.1"> <!-- Hide from old browsers function quiz(form) { var i = 0 var result1=document.form1.answer1.selectedIndex var result2=document.form2.answer2.selectedIndex var result3=document.form3.answer3.selectedIndex var result4=document.form4.answer4.selectedIndex var result5=document.form5.answer5.selectedIndex var result6=document.form6.answer6.selectedIndex var result7=document.form7.answer7.selectedIndex var result8=document.form8.answer8.selectedIndex if (result1==0){ alert("Question #1 was not answered");} if (result2==0){ alert("Question #2 was not answered");} if (result3==0){ alert("Question #3 was not answered");} if (result4==0){ alert("Question #4 was not answered");} if (result5==0){ alert("Question #5 was not answered");} if (result6==0){ alert("Question #6 was not answered");} if (result7==0){ alert("Question #7 was not answered");} if (result8==0){ alert("Question #8 was not answered");} else { if (result1==3){i++} if (result2==3){i++} if (result3==1){i++} if (result4==4){i++} if (result5==3){i++} if (result6==1){i++} if (result7==1){i++} if (result8==2){i++} document.total.score.value = i var per = Math.round((i / 20) * 100) document.total.percent.value = per if (result1 != 3){document.form1.check1.checked = true} else {document.form1.check1.checked = false} if (result2 != 3){document.form2.check2.checked = true} else {document.form2.check2.checked = false} if (result3 != 1){document.form3.check3.checked = true} else {document.form3.check3.checked = false} if (result4 != 4){document.form4.check4.checked = true} else {document.form4.check4.checked = false} if (result5 != 3){document.form5.check5.checked = true} else {document.form5.check5.checked = false} if (result6 != 1){document.form6.check6.checked = true} else {document.form6.check6.checked = false} if (result7 != 1){document.form7.check7.checked = true} else {document.form7.check7.checked = false} if (result8 != 2){document.form8.check8.checked = true} else {document.form8.check8.checked = false} } } //--> </SCRIPT> <style type="text/css"> <!-- body { margin-left: 10px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; } --> </style></HEAD> <BODY> <FORM NAME="form1"><INPUT TYPE="hidden" NAME="check1"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer1" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-1a0"> <input name="sample-radio" id="sample-radio-1a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-1a1"> <input name="sample-radio" id="sample-radio-1a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-1a2"> <input name="sample-radio" id="sample-radio-1a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-1a3"> <input name="sample-radio" id="sample-radio-1a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-1a4"> <input name="sample-radio" id="sample-radio-1a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form2"><INPUT TYPE="hidden" NAME="check2"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer2" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-2a0"> <input name="sample-radio" id="sample-radio-2a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-2a1"> <input name="sample-radio" id="sample-radio-2a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-2a2"> <input name="sample-radio" id="sample-radio-2a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-2a3"> <input name="sample-radio" id="sample-radio-2a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-2a4"> <input name="sample-radio" id="sample-radio-2a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form3"><INPUT TYPE="hidden" NAME="check3"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer3" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-3a0"> <input name="sample-radio" id="sample-radio-3a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-3a1"> <input name="sample-radio" id="sample-radio-3a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-3a2"> <input name="sample-radio" id="sample-radio-3a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-3a3"> <input name="sample-radio" id="sample-radio-3a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-3a4"> <input name="sample-radio" id="sample-radio-3a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form4"><INPUT TYPE="hidden" NAME="check4"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer4" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-4a0"> <input name="sample-radio" id="sample-radio-4a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-4a1"> <input name="sample-radio" id="sample-radio-4a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-4a2"> <input name="sample-radio" id="sample-radio-4a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-4a3"> <input name="sample-radio" id="sample-radio-4a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-4a4"> <input name="sample-radio" id="sample-radio-4a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form5"><INPUT TYPE="hidden" NAME="check5"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer5" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-5a0"> <input name="sample-radio" id="sample-radio-5a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-5a1"> <input name="sample-radio" id="sample-radio-5a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-5a2"> <input name="sample-radio" id="sample-radio-5a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-5a3"> <input name="sample-radio" id="sample-radio-5a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-5a4"> <input name="sample-radio" id="sample-radio-5a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form6"><INPUT TYPE="hidden" NAME="check6"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer6" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-6a0"> <input name="sample-radio" id="sample-radio-6a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-6a1"> <input name="sample-radio" id="sample-radio-6a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-6a2"> <input name="sample-radio" id="sample-radio-6a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-6a3"> <input name="sample-radio" id="sample-radio-6a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-6a4"> <input name="sample-radio" id="sample-radio-6a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form7"><INPUT TYPE="hidden" NAME="check7"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer7" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-7a0"> <input name="sample-radio" id="sample-radio-7a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-7a1"> <input name="sample-radio" id="sample-radio-7a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-7a2"> <input name="sample-radio" id="sample-radio-7a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-7a3"> <input name="sample-radio" id="sample-radio-7a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-7a4"> <input name="sample-radio" id="sample-radio-7a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <FORM NAME="form8"><INPUT TYPE="hidden" NAME="check8"> <b>1. Who wrote the Eagles' 1972 hit "Take It Easy"?</b><BR><BR> <input type="hidden" SELECT NAME="answer8" SIZE=1> <fieldset class="radios"> <label class="label_radio" for="sample-radio-8a0"> <input name="sample-radio" id="sample-radio-8a0" NAME="radio" type="radio" SELECTED VALUE="0"/> CHOOSE AN ANSWER</label> <label class="label_radio" for="sample-radio-8a1"> <input name="sample-radio" id="sample-radio-8a1" NAME="radio" type="radio" VALUE="1" /> Randy Meisner</label> <label class="label_radio" for="sample-radio-8a2"> <input name="sample-radio" id="sample-radio-8a2" NAME="radio" type="radio" VALUE="2" /> J.D. Souther</label> <label class="label_radio" for="sample-radio-8a3"> <input name="sample-radio" id="sample-radio-8a3" NAME="radio" type="radio" VALUE="3" /> Jackson Browne & Glenn Frey</label> <label class="label_radio" for="sample-radio-8a4"> <input name="sample-radio" id="sample-radio-8a4" NAME="radio" type="radio" VALUE="4" /> Don Henley</label> </fieldset> </SELECT></FORM> <BR> <BR><BR><HR> <P>That's it! Now click the "Submit" button to grade your Seventies music knowledge.<BR> <form name="total"> <INPUT TYPE="BUTTON" VALUE="Submit" onClick="quiz()"> <INPUT TYPE="button" VALUE="Reload Quiz" onClick='parent.location="javascript:location.reload()"'><BR><HR><BR>Results:<BR><BR> You scored <INPUT TYPE="TEXT" NAME="score" VALUE="" SIZE=5> out of <INPUT TYPE="TEXT" NAME="outof" VALUE="8" SIZE=5> questions correct.<BR><BR> Your Sco <INPUT TYPE="TEXT" NAME="percent" VALUE="" SIZE=3> %<BR><BR> <HR> </FORM> <script> var d = document; var safari = (navigator.userAgent.toLowerCase().indexOf('safari') != -1) ? true : false; var gebtn = function(parEl,child) { return parEl.getElementsByTagName(child); }; onload = function() { var body = gebtn(d,'body')[0]; body.className = body.className && body.className != '' ? body.className + ' has-js' : 'has-js'; if (!d.getElementById || !d.createTextNode) return; var ls = gebtn(d,'label'); for (var i = 0; i < ls.length; i++) { var l = ls[i]; if (l.className.indexOf('label_') == -1) continue; var inp = gebtn(l,'input')[0]; if (l.className == 'label_check') { l.className = (safari && inp.checked == true || inp.checked) ? 'label_check c_on' : 'label_check c_off'; l.onclick = check_it; }; if (l.className == 'label_radio') { l.className = (safari && inp.checked == true || inp.checked) ? 'label_radio r_on' : 'label_radio r_off'; l.onclick = turn_radio; }; }; }; var check_it = function() { var inp = gebtn(this,'input')[0]; if (this.className == 'label_check c_off' || (!safari && inp.checked)) { this.className = 'label_check c_on'; if (safari) inp.click(); } else { this.className = 'label_check c_off'; if (safari) inp.click(); }; }; var turn_radio = function() { var inp = gebtn(this,'input')[0]; if (this.className == 'label_radio r_off' || inp.checked) { var ls = gebtn(this.parentNode,'label'); for (var i = 0; i < ls.length; i++) { var l = ls[i]; if (l.className.indexOf('label_radio') == -1) continue; l.className = 'label_radio r_off'; }; this.className = 'label_radio r_on'; if (safari) inp.click(); } else { this.className = 'label_radio r_off'; if (safari) inp.click(); }; }; </script> <P>Ratings:<br><br> 90-100% - "I Just Want To Celebrate"<br> 80-89% - "I Want To Take You Higher"<br> 70-79% - "One Toke Over The Line"<br> 60-69% - "What's Going On"<br> 50-59% - "Stuck In The Middle With You"<br> 0-49% - "Ball of Confusion"<br> </blockquote> </BODY> </HTML> This should be simple, but I can't quite get it to work without some kind of side-effect. I've checked the forum and there doesn't seem to be anything that directly relates. What I want to do is convert the text that a user is typing to uppercase as they type it. What I have so far: function convertToUppercase(aControl) { var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;"; if (cursorKeys.indexOf(event.keyCode+";") == -1) { aControl.value = aControl.value.toUpperCase(); } } <input onkeyup="convertToUppercase(this)"/> The problem that I have is that this moves the cursor to the end of the line after every character. If you want to go and add something to the middle of what you've typed, you can type one character and then the cursor jumps to the end. e.g. inserting "abc" between the "R" and "E" of "FRED" gets you: FRAEDBC What I need is either: 1) ability to get the cursor/caret position and restore it after I set the uppercase string -- or -- 2) ability to intercept the keystroke in the event and make it uppercase before the browser adds it naturally to the input's value. Solution should be browser-independent (if at all possible). I'm mostly interested in IE though. Thanks, Chris Hi , I want to pop up alert when the user browse file into input for example i have this input Code: <input type="file" name="myfiles[]" /> now , when the user finish to browse an file i want a function to start working , what i mean by finish browse file is when the user select file and than click on the file he selected twice and than when the browsing files windows close i want this function to start how to do that? Hi, I need some help with a bit of a challenge. I need to allow users to spesify a file stored on their hard drive, read the file and populate a table and eventually a database. I can probably upload the file using <input type='file'> but what then? How do I access the file after this, or is there a better way? Using XMLHTTP gives 'access denied.....' I can not use PHP as the site does not support PHP. For those who know the environment - it's a QuickBase application I need to upload to....... Thanks Nic Howdy I have a <input type="File"> in my html, I need it because the user can select a jpg image and when they click submit it will post that image to a webservice. My question... Is their a way to load the file they selected so that I can draw it on a canvas? Sounds simple but I cannot figure it out! Thanks in advance Eckythump Evening all With a single file input, if you use JS to get the value of a file input field it returns the filename. In HTML 5 though you can upload multiple files at once. However, using JS to read the value of the field just returns a single filename, even if multiple files are there. This is slightly complicated as I can't click on the input box to see whether all the filenames are listed there or just one, because doing so opens the choose file dialogue box. However, all the files are being uploaded. What I want to do is use JS to validate the filenames prior to upload, but it only seems to be doing the last one selected. Any ideas on how to return all the filenames? Thanks, Chris Hello all, I have in my application input type file for uploading files. How can i do javascript validation to check if filename has special characters in it?? Thanks Yes - I need a script that will validate user input against a text file - exactly like the one in the left sidebar at http://www.oilpatchfuel.com/Pages/Welcome.aspx titled "Delivery Area". Thanks! hi, i am using <input type = "file" id = "upload"> in my html page. i want to disable the textbox of this control so that user cannot type any file location here. user can upload file only through browse button. is there a way to disable this textbox thru javascript? thnx Hey all, How do I get the childelements of a div, but only the child elements that are "ahref" tags? for example: <div id="someDivID"> <a href="somepath.html">link 1</a> <a href="somepath.html">link 2</a> <div></div> <a href="somepath.html">link 3</a> <span></span><div></div> <a href="somepath.html">link 1</a> </div> I want all the childElements under someDivID that are "a href" types... I am using prototype: I figured the following would work, but didn't. $('someDivID').childElements.getElementByTagName('a') any ideas? I am wanting to enable a file to be uploaded and attached to an email form. I however wish to only limit this to picture files with a size no larger than 1MB. Is there a way to do this with javaScript. My Html code: Code: <!-- Add a picture file --> <tr><td align="left">Upload your favourite Yorkie photo for the Picture of the Month.<br /> <input type="file" name="upload" accept="image/gif" size="30" style="margin-left: 15px; margin-top:5px; color: #0000; background-color: #00FF77;" /></td></tr> Just need to know if this can be validated with javascript to ensure the conditions are as per above. I am thinking this should be fairly easy but yet I am not getting far. I want to have a form with a single text imput field for a zip code. Depending on which zip code the user enters will determine which url they will be sent to. If they enter a zip code which is not in the script, they would be sent to a default url. I am also assuming this can be accomplished with javascript. Any help is greatly appreciated. I have a problem with adding new inputs to a form (if and when required), Internet Explorer is fine but in Firefox if any previous input fields are filled when the more button is clicked they get reset to blank. JS: Code: fields = 0; function addInput() { if (fields != 100) { document.getElementById('input').innerHTML += "<input type='text' name='input[]' size='30' />"; fields += 1; } else { document.getElementById('input').innerHTML += "<br />Maximum 100 fields allowed."; document.form.add.disabled=true;} } form: Code: <form action="index.php" method="post"> <div id="input"> <input type="text" name="input[]" size="30" maxlength="15" /> </div> <!-- button --> <div id="more"> <input type="button" onclick="addInput()" name="add" value="More" /> </div> <!-- // button --> <input type="submit" name="submit" value="Submit" /> </form> as usual any help is appretiated .. Hi, i want to set an input value to the same value as the input selected from another input on the same form so when the user selects input 1 i want the hidden input2 to get the same value im guessing i use onsubmit because its hidden so there wont be a focus or blur this would be part of the input Code: onsubmit="(this.value = this.othervalue)" othervalue being the other input name="othervalue" is that the correct syntax Hi, i have an input value array for customer ids, i also need to make a copy of that array into another input element on submit to use for another process. So far here is what i have come up with regarding the js the current html is this Code: <!-- original input --> <input id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $commissions[$i]['id'];?>" onclick="isChecked(this.checked);" type="checkbox" /> <!-- this is new html input which is outside the $i loop that i need a copy of cid[] stored on submit <input type="hidden" name="ids[]" onsubmit="valueTovalue();" /> <!-- here is the js so far --> <script type="text/javascript"> function valueTovalue() { var valin = document.adminForm.cid.value; //cid is the array cid[] document.adminForm.ids.value = valin; //copy the array to the new input element array ids } </script> so basically if they click 1 cid then ids will also show 1, if they click all cid then ids will show all as well. will that work the way i have it, am i even close here.. thanks update: what i have seems to work fine for text values or string values but not for arrays, what am i missing that it wont copy an array? Array ( [cid] => Array ( [0] => 1 ) [task] => remarksonly [remark] => hhhyyy [boxchecked] => 1 [ids] => Array ( [0] => ) ) am i getting closer lol Code: function valueTovalue() { var valin = cid.concat; document.adminForm.ids.value = valin.concat; return(true); this has to be close i hope Code: document.adminForm.ids.value = [].concat(document.adminForm.cid); Hi all can someone guide me (total JS newbie) on this presumably pretty easy task? I have a "parent" page with some text inputs in it (a form). This is what I am after: -when the user clicks a link it pops open a new window via JS - "child" (this is working). -in the "child" window there are also some text inputs (another form) (done). -when the user changes the value for 'testChild_textInput_4' in the child window, then I want it to automatically set this same value, to effectively overwrite, what is currently in 'testParent_textInput_2' in the parent window. Presumably this involves an onChange event, but it is also OK with me if the needful (the text input's value in the parent window being overwritten) happens upon the child window's form submit. If anyone can show me either trick, I would be thrilled! I set up a test page to make this all easy to talk about: http://www.yellow-turtle.com/testDumpMe_parent.html Please let me know! Thanks! -John I can get this code to take two separate sections of a file which are not beside each other and write them into another file. It always comes up as a single full line of the code instead of the sections I want. The code includes the student number first name last name and three results of assignments. I want the code to write the student number and three results of all the students into a file and then work out the average of the student results. Can you help? Code: try{ while (in.hasNextLine()) { String line = in.nextLine(); out.println( line); int i=0; if(!Character.isDigit(line.charAt(i))) { i++; } studentStringNumber = line.substring(0, i); String stringResult = line.substring(i); studentStringNumber = studentStringNumber.trim(); stringResults = stringResults.trim(); double stringResultsValue = Double.parseDouble(stringResults.trim()); stringResults = in.nextLine(); studentStringNumber = in.nextLine(); studentNumber = Integer.parseInt(studentStringNumber); if(in.hasNextInt()) { int value = in.nextInt(); } results = Double.parseDouble(stringResults); if(in.hasNextDouble()) { double value = in.nextDouble(); } Scanner lineScanner = new Scanner(line); studentStringNumber = lineScanner.next(); while(!lineScanner.hasNextDouble()) { studentStringNumber = studentStringNumber+ " " +lineScanner.next(); } stringResultsValue = lineScanner.nextDouble(); } } Hi, Can someone tell me what I am doing wrong. Script works on the first attachment but not the other two? Code: <script type="text/javascript" language="JavaScript"><!-- function ExtensionsOkay() { var extension = new Array(); var fieldvalue = new Array(); fieldvalue[0] = document.customApp.attachment_1.value; fieldvalue[1] = document.customApp.attachment_2.value; fieldvalue[2] = document.customApp.attachment_3.value; extension[0] = ".doc"; extension[1] = ".docx"; extension[2] = ".txt"; extension[3] = ".pdf"; // No other customization needed. for(var f = 0; f < fieldvalue.length; f++) { var thisext = fieldvalue[f].substr(fieldvalue[f].lastIndexOf('.')); for(var i = 0; i < extension.length; i++) { if(thisext == extension[i]) { return true; } } alert("Your upload field " + f + " contains an unapproved file name."); return false; } } //--></script> Does anyone know how to accomplish this? I got the html file to show but none of the text in the file will show.
|