JavaScript - Writing Xml Via Javascript
I want to write an xml stream to the browser using javascript. What I am currently getting is the visual data and the page source is the xml stream. What I would like to get is a visual representation of the xml as well as the underlying page source.
Further information. The visual presentation wanted is: <?xml version="1.0" encoding="UTF-8" ?> - <FSResult> <FoodStampAllotment>526</FoodStampAllotment> <GrossEligible>TRUE</GrossEligible> <NetEligible>TRUE</NetEligible> <AssetEligible>TRUE</AssetEligible> </FSResult> The page source for that is: <?xml version="1.0" encoding="UTF-8" ?><FSResult><FoodStampAllotment>526</FoodStampAllotment><GrossEligible>TRUE</GrossEligible><NetEligible>TRUE</NetEligible><AssetEligible>TRUE</AssetEligible></FSResult> The page url includes: FSCalcServlet.do The other visual presentation that we want to look like the above: 150TRUETRUETRUE The other page source is: <?xml version="1.0" encoding="UTF-8" ?><FSResult><FoodStampAllotment>150</FoodStampAllotment><GrossEligible>TRUE</GrossEligible><NetEligible>TRUE</NetEligible><AssetEligible>TRUE</AssetEligible></FSResult> The other page url includes: FSCalc.html This version is written from Flex via javascript and the original is a java servlet. Similar TutorialsHello, I am a novice and am hoping I can get some help here. I am self taught at basic HTML and am now trying to add some "v v vroom!" to a site that I am developing. The problem I am faced with is I have a Javascript that I am using as an experiment to see how Javascript works (in the hope that I can use other more exiting Javascripts on my sight I am buliding). I have copied it onto NotePad from a self teaching book which when opened up in a browser does not work. The script in question is; <html> <head> <title>My First Javascript page</title> <script type="text/javascript"></script> <style type="text/css"> body {document.bgcolor="pink"} </style> <body> This is my first Javascript page !! So **** off! <form> <input type="button" onclick="document.bgcolor='blue'" name="change" value="blue"> <input type="button" onclick="document.bgcolor='red'" name="change" value="red"> <input type="button" onclick="document.bgcolor='yellow'" name="change" value="yellow"> <input type="button" onclick="document.bgcolor='white'" name="change" value="white"> <input type="button" onclick="document.bgcolor='fuchsia'" name="change" value="fuchsia"> </form> </body> </html> Can anyone shed any light on what I might be doing wrong, or what I can do to make it work? Thank you all in advance. David Hood. I've looked on several websites and several threads here regarding writing and reading cookies with javascript, and I just can't seem to get it to work. All I want is a simple text box with 2 buttons: Save and Recall. Text entered into box is saved to a cookie when "Save" is pressed, and at a later date when "Recall" is pressed the saved text will show up in the box. Can you help please? i have borrowed a java script to produce a weather forecast using data from my weather station. Quote: //code to get your variables goes here //I've assumed they a // $sager_wind = wind direction // $sager_rumbo = wind change // $sager_hpa = Baro value // $sager_trend = Baro trend // $sager_nubes = Sky condition //now we can prepare them for the Sager script //the sager script wants uppercase, so just to be sure... $sager_wind = strtoupper($sager_wind); //has to be uppercase $sager_rumbo = strtoupper($sager_rumbo); //allow for either of mB or Hg input if ($sager_hpa > 50) { $sager_hpa = $sager_hpa * 0.0295300;} //enumerate the Baro switch ($sager_hpa) { case ($sager_hpa > 30.4): $sager_hpa = 1; break; case ($sager_hpa > 30.1): $sager_hpa = 2; break; case ($sager_hpa > 29.9): $sager_hpa = 3; break; case ($sager_hpa > 29.7): $sager_hpa = 4; break; case ($sager_hpa > 29.5): $sager_hpa = 5; break; case (sager_hpa > 29.2): $sager_hpa = 6; break; case (sager_hpa > 28.: $sager_hpa = 7; break; case (sager_hpa > 28.0): $sager_hpa = 8; break; } //enumerate the Baro trend if (strcasecmp($sager_trend, 'Rising Rapidly') == 0) { $sager_trend = 1; } if (strcasecmp($sager_trend, 'Rising Slowly') == 0) { $sager_trend = 2; } if (strcasecmp($sager_trend, 'Steady') == 0) { $sager_trend = 3; } if (strcasecmp($sager_trend, 'Falling Slowly') == 0) { $sager_trend = 4; } if (strcasecmp($sager_trend, 'Falling Rapidly') == 0) { $sager_trend = 5; } //enumerate the Sky condition if (strcasecmp($sager_nubes, 'Clear') == 0) { $sager_nubes = 1; } if (strcasecmp($sager_nubes, 'Partly Cloudy') == 0) { $sager_nubes = 2; } if (strcasecmp($sager_nubes, 'Mostly Overcast') == 0) { $sager_nubes = 3; } if (strcasecmp($sager_nubes, 'Overcast') == 0) { $sager_nubes = 4; } if (strcasecmp($sager_nubes, 'Rain') == 0) { $sager_nubes = 5; } ?> <html> <!-- standard header stuff goes here --> <!-- and don't forget to include the sager script --> <script src="sager_cast.js" type="text/javascript"></script> <body> <br /> Sager = <span id="forecast">forecast will appear here</span> <script type="text/javascript" language="javascript"> <!-- { //we could do some fancy escaping to directly insert the php variables //into the javascript function call, but this is harder to break. z_wind = "<?php echo $sager_wind?>"; z_rumbo = "<?php echo $sager_rumbo?>"; z_hpa = <?php echo $sager_hpa?>; z_trend = <?php echo $sager_trend?>; z_nubes = <?php echo $sager_nubes?>; document.getElementById('forecast').innerHTML = sager_cast( z_wind, z_rumbo, z_hpa, z_trend, z_nubes); } //--> </script> </body> </html> this basically turns my PHP variables intoa forecast by using the script above and also sager_cast.js (which crunches the numbers). my question is how can i record the output to a text file ie. this bit Quote: <br /> Sager = <span id="forecast">forecast will appear here</span> i know how to run a cron job on my host server but whenever i try to use php to geta at it, it fails. i understand that php and JS and side server / client server / host server different, but surely there must be a way to record the output using my host and the script that i have. my goal is to catch the forecast every 15 mins (with a time stamp) and then look back at the (text) file to see how it has changed. can anyone please help? one suggestion is to turn the number crunching JS script into php so i can 'get at it' but there are thousands of lines of code! thanks in advance, and hello from a newbie poster! Hi, I haven't really done any JavaScript programming and need help writing a couple of functions for a very basic sudoku game I am trying to build. Basically I want it to highlight which in green the correct answers and red the wrong ones. The names of the input fields of the table cells are the correct answer so I need a function that will compare the name of and input with the value, if the match then change the cell green, if not turn it red. Bellow is the code i have written with unessecary parts taken out Code: <?php $level = array ( "Easy" => array ("9","4","6","2","8","7","3","5","1","5","8","3","6","1","9","7","4","2","2","1","7","5","4","3","6","9","8","8","6","5","4","3","2","1","7","9","7","2","1","9","6","5","4","8","3","4","3","9","1","7","8","5","2","6","6","7","8","3","2","4","9","1","5","3","9","4","8","5","1","2","6","7","1","5","2","7","9","6","8","3","4"), "Medium" => array ("6","5","9","8","2","4","3","1","7","4","3","1","5","9","7","8","2","6","8","7","2","1","3","6","9","5","4","2","6","5","9","4","8","7","3","1","1","9","7","6","5","3","4","8","2","3","4","8","7","1","2","6","9","5","9","2","6","4","8","5","1","7","3","7","1","3","2","6","9","5","4","8","5","8","4","3","7","1","2","6","9"), "Hard" => array ("9","8","3","7","2","1","6","5","4","7","6","5","8","4","9","3","2","1","1","2","4","3","6","5","7","9","8","8","1","7","9","5","6","2","4","3","3","4","6","2","1","8","5","7","9","5","9","2","4","7","3","1","8","6","6","7","8","5","3","4","9","1","2","4","5","1","6","9","2","8","3","7","2","3","9","1","8","7","4","6","5") ); $mask = array ( "Easy" => array ("0","4","6","2","8","0","0","0","0","5","0","0","6","0","0","7","4","0","2","0","0","0","0","0","0","0","0","0","0","5","0","3","2","0","7","0","0","2","1","0","0","0","4","8","0","0","3","0","1","7","0","5","0","0","0","0","0","0","0","0","0","0","5","0","9","4","0","0","1","0","0","7","0","0","0","0","9","6","8","3","0"), "Medium" => array ("0","0","0","8","0","0","0","1","7","4","3","0","0","0","0","0","0","0","0","0","2","0","0","0","9","0","0","2","0","0","0","0","8","0","0","0","0","9","7","6","0","3","4","8","0","0","0","0","7","0","0","0","0","5","0","0","6","0","0","0","1","0","0","0","0","0","0","0","0","0","4","8","5","8","0","0","0","1","0","0","0"), "Hard" => array ("9","0","0","0","0","1","0","5","0","7","6","5","0","0","0","0","0","0","1","0","0","3","0","0","0","0","8","0","0","0","0","0","6","0","4","0","0","0","0","2","1","8","0","0","0","0","9","0","4","0","0","0","0","0","6","0","0","0","0","4","0","0","2","0","0","0","0","0","0","8","3","7","0","3","0","1","0","0","0","0","5") ); $difficulty = $_GET["difficulty"]; $style = $_GET["style"]; ?> <!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> <script src="sudoku.js" language="javascript" type="text/javascript"></script> </head> <body> <div id="wrap"> </div> <div id="nav"> <div class="option-item"> <form action="index.php" method="get"> <input type="submit" name="difficulty" value="Easy" /> <input type="submit" name="difficulty" value="Medium" /> <input type="submit" name="difficulty" value="Hard" /> </form> </div><input type="button" class="control-button" onclick="checkStatus()" value="How am I Doing?" /> </div> <div id="main"> <form name="f"> <?php $box = $mask[$difficulty]; ?> <table class="root-table"> <tr> <td> <table class="box box-one"> <tr> <td><input type="text" size="1" name="<?php echo $level[$difficulty][0]; ?>" value="<?php if ($mask[$difficulty][0] > 0) echo $mask[$difficulty][0]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][1] > 0) echo $mask[$difficulty][1]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][2] > 0) echo $mask[$difficulty][2]; ?>" /></td> </tr> <tr> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][9] > 0) echo $mask[$difficulty][9]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][10] > 0) echo $mask[$difficulty][10]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][11] > 0) echo $mask[$difficulty][11]; ?>" /></td> </tr> <tr> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][18] > 0) echo $mask[$difficulty][18]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][19] > 0) echo $mask[$difficulty][19]; ?>" /></td> <td><input type="text" size="1" value="<?php if ($mask[$difficulty][20] > 0) echo $mask[$difficulty][20]; ?>" /></td> </tr> </table> Q1. write a function called countAS that will take a string as input (using a prompt dialog box,prompt the user or the string).the string must contain only a's,b's and c's e.g. "abccbbaa" or "aaabbbccc" if any other letters are present apart from the letters a b c, output an alert dialog box with an error message and prompt the user again to input a valid string.count the number of a's the numbers of b's and the numbers of c's entered and display the count for each as well as a total count of all the characters within the string . for example if the string was abbcc output should be as follows: the total count is 5 characters The Number of a's is 1 The Number of b's is 2 The Number of c's is 2 Q2. write a code that uses an event handler to display an alert dialog box with the message 'hello to you all' when a user clicks a link in a html page which links to the school of computing website. Writing Table Cells and Switch Statements I am to create a function and purpose is to write blank tables cells to make up horizontal bar. function will have 2 parameters=(partyType and percent partyType parameter stores variables of D,R,I,G or L percent parameter store percentage rounded to nearest integer so I am to make a switch and break statements /commands then have to create a For Loop in counter variable goes up from 1 through value of parmeter increments of 1 heres the code I created for this one Code: function createBar(partyType,percent){ // script element to create blank cells switch(partyType) { case "D": document.write("<td class='dem'></td>"); break; case "E": document.write("<td class='rep'></td>"); break; case "I": document.write("<td class='ind'></td>"); break; case "G": document.write("<td class='green'></td>"); break; case "L": document.write("<td class='lib'></td>"); break; } var barText = partyType for (i=0; i < percent; i++) { document.write(barText); So what improvements should I make? should my loop be before everything? Thanks hi all, I am fairly new to Javascript, and am trying to "print" a var inside a script. I have this piece of script, which loads images from a gallery: Code: $(document).ready(function(){ $('title').text('G3 Ajax Gallery'); loadGallery('/gallery3/rss/feed/gallery/album/114'); }); The number 114 defines what part of the gallery to be loaded. I would like to define this with a var, but dont know how to "print" it into the url. So: loadGallery('/gallery3/rss/feed/gallery/album/114'); woulkd become something like: loadGallery('/gallery3/rss/feed/gallery/album/my_var'); Any help would be much apreciated. Thanks, Sion. Reply With Quote 01-21-2015, 12:41 PM #2 xelawho View Profile View Forum Posts Senior Coder Join Date Nov 2010 Posts 3,043 Thanks 56 Thanked 568 Times in 565 Posts PHP Code: var myvar=114; // or however you are defining it loadGallery('/gallery3/rss/feed/gallery/album/' + myvar); Yes, I have read the sticky about homework.. and before you call me a lazy sack, I will have to blame it all on my teacher... He knows almost nothing about the Java, and yet, he is teaching a computer programming class... This assignment is due soon, and I have no idea how you even start this..Really appreciate it if some1 can do this for me.. Assignment: Create a new 'Array' Project and create a java file that does the following. -Print your arrays going across the screen(horizontally) -Creating the arrays should be done in main -All other tasks should be in separate methods -Your arrays should be passed as a parameters -All methods should have a void return type 1.a)Create an array of 100 integers called nums. (All 1000 grades will automatically be initialized to 0) b) Fill the array with 1000 random numbers between 10 and 99. c) Print the grades forwards d) Print the grades backwards. e) Find the average of the grades and print the average 2 a) Create an array of 6 Strings called names (all 6 names will automatically be initialized to null.) b) Fill your array with 6 names (you will have to do this individually). c) Print all names that start with a vowel. Thank to so much if someone really help me with this! I need to reset the active content registry entries to the defaults when a page unloads: Code: <script> // Window Onunload, last to execute, manage registry function windowonunload(){ var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_LOCALMACHINE_LOCKDOWN\\iexplore.exe\\", 1, "REG_DWORD"); WshShell.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_LOCALMACHINE_LOCKDOWN\\Settings\\LOCALMACHINE_CD_UNLOCK\\", 0, "REG_DWORD"); } WScript.DisconnectObject(sh); WScript.Quit(); //--> </script> ...but it doesn't seem to work. What am I doing incorrectly? Thanks. So I need to know how I can write this more efficiently. I been told that a loop should work, but I can't figure a good way to do it. Im very new to javascript, so I was hoping someone may be able to help. Code: document.getElementById('tabButton1').onclick=function(){ document.getElementById('tabDiv1').className = 'tabActive' document.getElementById('tabDiv2').className = 'tabInactive' document.getElementById('tabDiv3').className = 'tabInactive' document.getElementById('tabDiv4').className = 'tabInactive' document.getElementById('tabButton'+1).className = 'tabActive' document.getElementById('tabButton2').className = 'tabInactive' document.getElementById('tabButton3').className = 'tabInactive' document.getElementById('tabButton4').className = 'tabInactive' }; document.getElementById('tabButton2').onclick=function(){ document.getElementById('tabDiv1').className = 'tabInactive' document.getElementById('tabDiv2').className = 'tabActive' document.getElementById('tabDiv3').className = 'tabInactive' document.getElementById('tabDiv4').className = 'tabInactive' document.getElementById('tabButton1').className = 'tabInactive' document.getElementById('tabButton2').className = 'tabActive' document.getElementById('tabButton3').className = 'tabInactive' document.getElementById('tabButton4').className = 'tabInactive' }; document.getElementById('tabButton3').onclick=function(){ document.getElementById('tabDiv1').className = 'tabInactive' document.getElementById('tabDiv2').className = 'tabInactive' document.getElementById('tabDiv3').className = 'tabActive' document.getElementById('tabDiv4').className = 'tabInactive' document.getElementById('tabButton1').className = 'tabInactive' document.getElementById('tabButton2').className = 'tabInactive' document.getElementById('tabButton3').className = 'tabActive' document.getElementById('tabButton4').className = 'tabInactive' }; document.getElementById('tabButton4').onclick=function(){ document.getElementById('tabDiv1').className = 'tabInactive' document.getElementById('tabDiv2').className = 'tabInactive' document.getElementById('tabDiv3').className = 'tabInactive' document.getElementById('tabDiv4').className = 'tabActive' document.getElementById('tabButton1').className = 'tabInactive' document.getElementById('tabButton2').className = 'tabInactive' document.getElementById('tabButton3').className = 'tabInactive' document.getElementById('tabButton4').className = 'tabActive' }; All help is appreciated. Thanks Dear friends , I tried to write in html page from text file using " <html> <head> <script type="text/javascript" language="javascript"> function Read() { var Scr = new ActiveXObject("Scripting.FileSystemObject"); var CTF = Scr .OpenTextFile("C:\\123.txt", 1, true); data = CTF .ReadAll(); document.write(data); alert(data); CTF .Close(); } </script> </head> <body onLoad="Read()"> </body> </html> " But the contains of text file getting changed , like if there is "My name is Karimkhan I love India " Then it will write like "My name is Karimkhan i love India" It ignores multiple spaces and new line character , so what should I do to prevent this...IS THERE ANYTHING LIKE <PRE> TAG IN HTML "? Hi Guys I'm struggling to find out why the iframe is not being populated with a selectbox containing the album names from an XML file. majority of the code is working fine and the "alert(s)" function works perfectly and displays exactly the html I would like it to but the bits in bold are not working and are not writing the html to the iframe. (please note, this code is only supposed to work in Javascript) . Thanks Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <script type="text/javascript"> function loadXML(docName){ if (window.XMLHttpRequest){ xhttp=new XMLHttpRequest(); } else{ xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",docName,false); xhttp.send(); return xhttp.responseXML; } tunesData=loadXML("music.xml"); albumsArray=tunesData.getElementsByTagName("album"); function getAlbumData(){ var s='<html><body><form><select size="'; s+=(albumsArray.length+1); s+='"><option>...Please Select An Album...</option>' for(i=0;i<albumsArray.length;i++){ s+='<option>'; s+=albumsArray[i].childNodes[1].childNodes[0].nodeValue; s+='</option>' } s+='</select></form></body></html>'; alert(s); with(document.getElementById('albumscol').contentDocument){ open(); write(s); close(); } } getAlbumData(); </script> </head> <body> <iframe id="albumscol"></iframe> </body> </html> I have a piece of code which I suppose to click on to activate: Code: <a href ="javascript:(function() { newwindow = window.open(); newwindow.document.write('<html><head><title>Your new title here</title></head>'); newwindow.document.write('<body><embed src = 'http://www.flashppt.com/images/tangramone.swf' height='100%' width='100%'></embed></body></html>'); } )();"> Run flash popup </a> I have spent a very long time looking at it but I still can't figure it out. The problem is with line with <embed> tag. My purpose is to open a swf flash in a new popup window such that it must have a Pretty title name (instead of its addresss). Since opening that SWF directly does not leave me the option of change the popup title , so I use the above method... I appreciate much if you can help ! Ok, so i need help writing a java script that will look at a bunch of numbers and output the highest one so what i need is for it to do something like this. (A is my input value) (B is my output value) the (A) value will be constantly changing and with the script has to do is look at all of those values and output them to (b) if anyone knows how to do this i would be so grateful if they could write the code for me because i'm new to coding and i really need this to work. thanks. hey guys, im trying to write whether player 1 or 2 won into the text area. see code below. thanks [CODE] <html> <head> <script type="text/javascript"> var a=1 </script> <style type="text/css"> body { background-image: url(http://fc08.deviantart.com/fs40/i/2009/018/f/8/FLOWJOB_3d_graffiti_by_UrbanCalligraphism.jpg); } h1 { font-family:"sans-serif",tahoma; background-repeat: no-repeat; color:#00ffe7; } p { color:#000000; font-family:"sans-serif",tahoma; font-weight:900; } </style> </head> <body> <center><h1>Ghetto Dice Project</h1></center> </br> </br> </br> </br> </br> </br> <center> <textarea rows="9" cols="18" id="textarea"> </textarea> </center> </br> </br> </br> </br> </br> <center> <table> <tr> <input type="text" id="playerone" size="4" value=""> <input type="text" id="playertwo" size="4" value=""> </tr> </br> <tr> <button onclick=" a=(Math.floor(Math.random()*13)); document.getElementById('playerone').value=a; "> PLAYA 1 </button> <button onclick=" b=(Math.floor(Math.random()*13)); document.getElementById('playertwo').value=b; "> PLAYA 2 </button> </tr> </table> </script> </br> </br> <p> Hand coded with care by Tanner Beck </p> </center> </body> </html> [CODE] Hello: First post here on CS ... I am wondering why my code will not write a new line or line break. This is fine: Code: <script> document.write("Hello and welcome to javascript!"); </script> But when I try to put a message on two lines, it does not work. The book I'm reading and several websites have stated the below codes will work, but neither do: Code: <script> document.write("Hello and welcome to javascript! \n"); document.write("It is a tricky language to learn!") </script> Code: <script> document.writeln("Hello and welcome to javascript!"); document.writeln("It is a tricky language to learn!") </script> Am I missing something? Hi, Here's what I've been trying a lot to find but to no avail: a simple text field and submit button that lets users insert an embedding (HTML/CSS/JavaScript codes) to display on the same frame. I'd like something like this: http://www.howtocreate.co.uk/tutoria...s/dywrite.html Unfortunately it doesn't run any code, e.g. Code: <html> <head> <script type="text/javascript"> function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); document.getElementById('txt').innerHTML=h+":"+m+":"+s; t=setTimeout('startTime()',500); } function checkTime(i) { if (i<10) { i="0" + i; } return i; } </script> </head> <body onload="startTime()"> <div id="txt"></div> </body> </html> Or the text marquee code on the following tutorial: http://www.dynamicdrive.com/dynamicindex2/cmarquee.htm Your help is greatly appreciated! Regards Rain Lover Hi folks. There have been several requests on this forum for subtotal/tax/total forms, but I know so little about Java scripts that I haven't been able to adapt your provided solutions to my needs. I know it seems like a cop-out to just ask someone else to do it for me, but I need to get this form functioning as soon as possible, since I'll be running business through this site (which, until now, I've designed on my own). I would like to learn JS eventually, or at least have a working knowledge of it, but I'm short on time right now. I know that a Java script should be able to do what I need it to, so if there's anyone out there who can help, I would be incredibly grateful. I hope it's not too much trouble. Here's the web page. I've kept my html nice and clean, so hopefully it's very easy to read: link What I need is to multiply the price of either size options by the quantity, add the sales tax and shipping, and the total will update automatically. The paper choice will not affect the price. Ideally, I would like the "submit request" button to send an email with all supplied information to my email address, and also send a copy to the supplied customer address. (I think that's considered a get/put script?) Again, if there's anyone who can help with this, I would be very grateful. Thanks, Jon Javascript (inside a function that everything works except this bit): Code: var uploadedfile = "upload" + ups; document.getElementById(uploadedfile).value= file; The input element its not changing: Code: <input type="text" name="upload[]" id="upload1"/> There are four additional input elements, one for each possible fileupload, they will be set to hidden but in order to see if it was submitting the name I set it to text. Here is the live page so you can see it: http://www.sandcrawler.net/forum/sandnet.php?page=test2 What this is for is an upload script, I have all the upload bit working, but now I need to find a way to pass the filename to my php script, that will then sort the files out into two types, screenshot and compressed. Then insert them into a mysql database. I've gotten this same type of thing to work on a w3school TryIt demo, with the variables set the same way. So I can't figure out where there is an error. Opera isn't giving me one. I can post more code if needed. Thanks All, I have the following code: Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title></title> <style type="text/css">body{font:62.5% Verdana,Arial,sans-serif}</style> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script> <script> $( "#drg" ).draggable({ revert: true }); var drpOptions = { drop: function(event, ui) { $(this).append( ui.draggable.text() + "<br>" ); } }; $( "#drplist" ).children().droppable( drpOptions ); $( "button" ).button().click(function() { $( "<li>Dynamic droppable<hr></li>" ).droppable( drpOptions ).appendTo( "#drplist" ); }); </script> <style type="text/css"> #drg { background: silver; width: 100px; padding: 0.5em; text-align: center; } ul, ul li { list-style: none; margin:0 ; padding: 0; } #drplist li { width: 200px; height: 100px; margin: 1em; padding: 0.5em; background: lightgreen; } </style> </head> <body> <div id="drg"> Drag me </div> <hr> <button>Click to add a droppable</button> <ul id="drplist"> <li>Drop here<hr></li> </ul> </body> </html> Basically what I would like to happen is that when I click on the button it generates the table like it did and then I want like two checkboxes next to it with some text and a break line in between the two. How can I update my jQuery to give me this result? Thanks in advance! |