JavaScript - Quicksort , Not Sorted List
when the function call end ,the list still not sorted . I don't know where is the wrong?! here is the code
[Quick sort] Code: var a=[4,1,10,9,7,12,8,2,15]; var l,r,i,j,p; quicksort(a,0,a.length-1); function quicksort(a,l,r){ document.write( "<h2>quicksort: ", a, "</h2>" ); // tracer code if (l<r){ p=a[r]; i=l-1; j=r; while (a[++i]<p ){ while (a[--j]>p){ if(i>=j) break ; swap(i,j);}} swap(i,r); quicksort(a,l,(i-1)); quicksort(a,i+1,r);}} function swap(x,y){ temp=a[x]; a[x]=a[y]; a[y]=temp;} Similar TutorialsSo there is a list that is sorted using quicksand. When page loads there is a scrollbar for the list, container has a height and overflow:auto applied. When the quicksand plugin filters the items and then rearranges them, it loses the scrollbar. how can I get it back? Link to Site/Code Hi all, I have been struggling on a bit of code for a while now. I need to populate a second drop down list (Region) based upon the selection of the first (County). I have found a piece of code that works on its own and have adapted to suit my needs - see below. However, when I drop it into my main page the javascript is not working. It's because of the formObject but I just don't know enough to resolve this! Furthermore, I need the textboxes the user has already completed in the form to retain their value once the javascript kicks in as the completed form will submit to a database. This piece of code is working well . . . . Code: <?php $link = mysql_connect('myhost', 'myusername', 'mypassword') or die('Could not connect: ' . mysql_error()); mysql_select_db('mydatabase') or die('Could not select database'); if(isset($_GET["County"]) && is_numeric($_GET["County"])) { $County = $_GET["County"]; } if(isset($_GET["Region"]) && is_numeric($_GET["Region"])) { $Region = $_GET["Region"]; } ?> <script language="JavaScript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="get"> <!-- County SELECTION BASED ON city VALUE --> <?php ?> <select name="County" onChange="autoSubmit();"> <option value=''</option> <?php //POPULATE DROP DOWN MENU WITH COUNTRIES FROM A GIVEN city $sql = "SELECT * FROM county_regions"; $counties = mysql_query($sql,$link); while($row = mysql_fetch_array($counties)) { echo ("<option value=\"$row[CountyID]\" " . ($County == $row["CountyID"]? " selected" : "") . ">$row[County]</option>"); } ?> </select> <?php ?> <br><br> <?php if($County!= null && is_numeric($County)) { ?> <select name="Region" onChange="autoSubmit();"> <?php //POPULATE DROP DOWN MENU WITH RegionS FROM A GIVEN city, County $sql = "SELECT * FROM county_regions WHERE CountyID = $County "; $Regions = mysql_query($sql,$link); while($row = mysql_fetch_array($Regions)) { echo ("<option value=\"$row[CountyID]\" " . ($Region == $row["CountyID"]? " selected" : "") . ">$row[Region]</option>"); } ?> </select> <?php } ?> What follows is my form where the javascript is not working - edited quite a bit to save on space! Code: <head> <script language="JavaScript"> function autoSubmit() { var formObject = document.forms['subform']; formObject.submit(); } </script> </head> <form enctype="multipart/form-data" method="post" action="add_attraction01.php" FORM NAME="FormName"> <input type="hidden" name="MAX_FILE_SIZE" value="32768" /> <label for="Business_name">Business Name</label> <input type="text" size="60" STYLE="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; background-color: #72A4D2;" <id="Business_name" name="Business_name" maxlength=60/><font size="1" face="arial" color="red">Required field</font><br /> <label for="StreetAddress">Address</label> <input type="text" size="60" rows="2" id="StreetAddress" name="StreetAddress" maxlength=120/><font size="1" face="arial" color="red">Required field</font><br /> <label for="Town">Town</label> <input type="text" size="25" id="Town" name="Town" maxlength=25/><font size="1" face="arial" color="red">Required field</font><br /> <?php $link = mysql_connect('myhost', 'myusername', 'mypassword') or die('Could not connect: ' . mysql_error()); mysql_select_db('mydatabase') or die('Could not select database'); if(isset($_GET["County"]) && is_numeric($_GET["County"])) { $County = $_GET["County"]; } if(isset($_GET["Region"]) && is_numeric($_GET["Region"])) { $Region = $_GET["Region"]; } ?> <form name = "subform" method="get"> <select name="County" onChange="autoSubmit();"> <option value=''</option> <?php $sql = "SELECT * FROM county_regions"; $counties = mysql_query($sql,$link); while($row = mysql_fetch_array($counties)) { echo ("<option value=\"$row[CountyID]\" " . ($County == $row["CountyID"]? " selected" : "") . ">$row[County]</option>"); } ?> </select> <?php ?> <br><br> <?php if($County!= null && is_numeric($County)) { ?> <select name="Region" onChange="autoSubmit();"> <?php $sql = "SELECT * FROM county_regions WHERE CountyID = $County "; $Regions = mysql_query($sql,$link); while($row = mysql_fetch_array($Regions)) { echo ("<option value=\"$row[CountyID]\" " . ($Region == $row["CountyID"]? " selected" : "") . ">$row[Region]</option>"); } ?> </select> <?php } ?> <input type="text" size="20"id="Tel_No" name="Tel_No" maxlength=20 onkeypress="return isNumberKey(event)"/><font size="1" face="arial" color="red">Required field</font><br /> <br/> <input type="submit" value="Submit your attraction" name="submit" onclick="return BothFieldsIdenticalCaseSensitive();"/> </form> </body> </html> It's probably obvious to you guys!! Thanks in advance for your help. 09-01-10 Not sure exactly where to post this thread as it involves HTML, Javascript and embedded media players. It probably would be more appropriate here as there is much Javascript involved.... Hello, I am trying to construct a Jukebox for my website. I have spent considerable time all over the WEB and at this forum which addressed the issue in a 50 page thread. Please see: http://codingforums.com/showthread.php?t=50666 I got a lot of ideas from this thread but still cannot figure a way to do the following within the Jukebox. These are my main two questions for everything below: 1. How can I have the Jukebox cycle through all tunes and then start over from the beginning? 2. How can I allow the user to select a tune from a list but not a drop down list, have the Jukebox start from the user’s selection and then play all songs to the end. Then as in #1, start over from the beginning? Per this thread I came away with basically two ways to assemble the jukebox. One uses links in a drop down list which the user can choose from. The other is to use an .m3u playlist. The user can only select a “playlist” from the drop down. Below, I have included the code for each Jukebox. To see the Jukeboxes in action please go to my website where I have posted some test pages exhibiting the jukeboxes that I am referring to. The following is the Jukebox which utilizes an .m3u playlist. If I end up using this idea I would like the tunes in the .m3u playlist to be displayed and allow the user to be able to choose a tune in the list. Then have the list play to the end of all tunes in the list. Then start over from the beginning of the list. After this code is the .m3u playlist. Go to url removed and click on the link that says: “Media Player Using an .M3U Playlist” Jukebox utilizing an .m3u playlist: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <style type="text/css"> body { text-align:center; } </style> <script type="text/javascript"> function PlayIt(what){ player.document.getElementById('music').innerHTML='<object width="300" height="300" ' +'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" ' +'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ' +'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">' +'<param name="url" value="'+what+'">' +'<param name="uiMode" value="full">' +'<param name="autoStart" value="true">' +'<param name="loop" value="true">' +'<embed type="application/x-mplayer2" ' +'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" ' +'showcontrols="true" uimode="full" width="300" height="45" ' +'src="'+what+'" autostart="true" loop="true">' +'</object>'; } </script> </head> <body> <div id="music"> <object width="300" height="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="url" value=""> <param name="uiMode" value="full"> <param name="autoStart" value="true"> <param name="loop" value="true"> <embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showcontrols="true" uimode="full" width="300" height="45" src="" autostart="true" loop="true"> </object> </div> <br> <br> <select name="player" onchange="PlayIt(this.value)"> <option value="none">::Choose a Song::</option> <option value="JukeboxList.m3u">Jukebox List</option> </select><br> </html> Here is the .m3u playlist for the above code: Code: #EXTM3U #EXTINF:Bill Evans - G Waltz media/G Waltz.mp3 #EXTINF:Dan Pincus - In Your Time media/In Your Time.mp3 The following code is for the Jukebox that has a list of links in a dropdown list. If I go with this idea, I would like for the list not to be a dropdown list but just a list of tunes. The user should be able to click on any tune in the list and the player should start from that point, play all the remaining tunes in the list and then start from the beginning. Go to url removed and click on the link that says: “Media Player Using Links” Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <style type="text/css"> body { text-align:center; } </style> <script type="text/javascript"> function PlayIt(what){ player.document.getElementById('music').innerHTML='<object width="300" height="300" ' +'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" ' +'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ' +'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">' +'<param name="url" value="'+what+'">' +'<param name="uiMode" value="full">' +'<param name="autoStart" value="true">' +'<param name="loop" value="true">' +'<embed type="application/x-mplayer2" ' +'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" ' +'showcontrols="true" uimode="full" width="300" height="45" ' +'src="'+what+'" autostart="true" loop="true">' +'</object>'; } </script> </head> <body> <select name="player" onchange="PlayIt(this.value)"> <option value="none">::Choose a Song::</option> <option value="media/GWaltz.mp3">G Waltz</option> <option value="media/InYourTime.mp3">In Your Time</option> <option value="http://urltosong3.mp3">Song 3</option> <option value="http://urltosong4.mp3">Song 4</option> <option value="http://urltosong5.mp3">Song 5</option> </select><br> <div id="music"> <object width="300" height="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="url" value=""> <param name="uiMode" value="full"> <param name="autoStart" value="true"> <param name="loop" value="true"> <embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showcontrols="true" uimode="full" width="300" height="45" src="" autostart="true" loop="true"> </object> </div> </html> Another idea I found on the WEB also uses an .m3u playlist. The good thing about it is that it lists all the tunes in the playlist which the user can then select from. This jukebox calls up an entire Windows Media Player. If I was to use this idea I would like to be able to disable the left side of the player where the user has options such as burning to CD, Media Guide, Radio Tuner etc… Go to url removed and click on the link that says: “Media Player Within an IFrame Using .m3u Playlist”” Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>JukeBox</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> </head> <body> <IFRAME name="frame" src="JukeboxList.m3u" width="100%" height="347" scrolling="no" frameborder="0"> [Your user agent does not support frames or is currently configured not to display frames.] </IFRAME> </body> </html> Thanks! Dan I would like to make an ordered list, for example: 1. Airplane 2. Boat 3. Car I'd like one of the words to be displayed on my webpage, for example: Boat Then I'd want an up button, and a down button. The up button would display Airplane instead of Boat, and the down button would display Car instead of Boat. Once it got to Car, the same up button would change it back to boat. How do I do this? Thanks. I have two lists/menus that are start and end times and I want to make the end time list/menu advance 2 hours from whatever is chosen in start list/menu. The values in both of the list/menu are [CODE] <select name="Time" class="Body" id="Time"> <option value="">Choose Start Time</option> <option value="06:00:00">6:00 am</option> <option value="06:30:00">6:30 am</option> <option value="07:00:00">7:00 am</option> <option value="07:30:00">7:30 am</option> ETC........ <select name="Time2" class="Body" id="Time2"> <option value="">Choose End Time</option> <option value="06:00:00">6:00 am</option> <option value="06:30:00">6:30 am</option> <option value="07:00:00">7:00 am</option> <option value="07:30:00">7:30 am</option> ETC........ [ICODE] any ideas on how to accomplish this? you can find my file at http://www.crazywayno.com/startend.php ---------------------------------------------------------------- I also tried this javascript but it doesn't add the additional 2 hours it just repeats the first value. [CODE] <script type="text/javascript"> function cfunc() { document.getElementById("Time2").value=document.ge tElementById("Time").value } </script> <select name="Time" type="text" id="Time" onmouseup="cfunc()"> <option value="">Choose Start Time</option> <option value="06:00:00">6:00 am</option> <option value="06:30:00">6:30 am</option> <option value="07:00:00">7:00 am</option> <option value="07:30:00">7:30 am</option> ETC.......... <select name="Time2" class="Body" id="Time2"> <option value="">Choose End Time</option> <option value="06:00:00">6:00 am</option> <option value="06:30:00">6:30 am</option> <option value="07:00:00">7:00 am</option> ETC........... [ICODE] You can find this at http://www.crazywayno.com/2fields.php Thanks Hi, I have two dropdown lists with the second one being dependent on the selection in the first. Options in list 1: 1,3 or 4 List two should be enabled when 3 or 4 is selected in list 1. So far so good, managed to get it to work with only one set of lists, but I actually have 18 of those sets in this form: Code: <select name="fw[$i]" id="fw[$i]"> <option value="1">FWH</option> <option value="3">links</option> <option value="4">rechts</option> <option value="0" selected></option> </select><br /> <select name="lie[$i]" id="lie[$i]" disabled="disabled" onchange="showBox($i,xxx);"> <option value="0" selected>---</option> <option value="1">gut</option> <option value="2">schlecht</option> <option value="3">Strafschlag</option> <option value="4">OB</option> </select> $i is my index generated by my PHP script and runs from 1 to 18. Everything works just fine as long as the index is not in play. With the index my function breaks, most probably due to my inability to extract the second parameter (xxx above) from the selection field. Here's my function, there could be something wrong there too with how exactly to specify the proper dropdown list to enable. Code: function showBox(field,val) { if (val > 1) { var box = 'lie[' + field + ']'; document.form1.box.disabled == false; } else { document.form1.box.disabled == true; } } Finally, I'm not that adept in javascript programming, more like a trial and error guy, how has hit the wall with this problem. Thanks in advance! Joe Sorry I just realized this should have been in server side... I'm trying to create a list of twitter users with a follow button next to each user. The user names are being pulled from a mysql database. Here's the code I have so far. I can get a list of user names from my database, put it into an array and I can replace the user name in the first follow button. I need to sequentially replace the $row variable in the script at the bottom so the follow button points to the users account each time it iterates through the array? I'm stuck on how to iterate this so that I get a list of all the users in the array with a follow button next to each user name. Any help or ideas would be greatly appreciated! I'm stuck and on a deadline. Code: <?php // Connect to database server mysql_connect("localhost", "root", "") or die (mysql_error ()); // Select database mysql_select_db("tewxadb") or die(mysql_error()); // SQL query $strSQL = "SELECT * FROM users"; // Execute the query (the recordset $rs contains the result) $rs = mysql_query($strSQL); // Loop the recordset $rs // Each row will be made into an array ($row) using mysql_fetch_array while($row = mysql_fetch_array($rs)) { // Write the value of the column username (which is now in the array $row) echo $row['username'] . "<br />"; } // Close the database connection mysql_close(); ?> <a href="https://twitter.com/" +$row(text) class="twitter-follow-button" data-show-count="true" data-lang="en">Follow </a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> I need help with this js... this is dropdown list...if user choose okc in first list(vrsta) in second (celik) user can choose C0270 and C0370...if chosen pc in first list in second user can choose C1330 and C1530 etc... There are two boxes...ans15 and ans14...and button which user clicks The idea is that user choose one option(okc,pc or cc) and choose option (C0270 or something else) onclick some values should be written in boxes example: chosen okc and C0270 in ans15 "hello" and in ans14 "goodbye" should be writen if chosen okc and C0370 in ans15 "hi" and in ans14 "bye" should be writen Code: <script type="text/javascript"> function setOptions(chosen) { var izbor = document.form3.celik; izbor.options.length = 0; if (chosen == " ") { izbor.options[izbor.options.length] = new Option('choose',' '); } if (chosen == "okc") { izbor.options[izbor.options.length] = new Option('C0270','C0270'); izbor.options[izbor.options.length] = new Option('C0370','C0370'); } if (chosen == "pc") { izbor.options[izbor.options.length] = new Option('C1330','C1330'); izbor.options[izbor.options.length] = new Option('C1530','C1530'); } if (chosen == "cc") { izbor.options[izbor.options.length] = new Option('C1120','C1120'); izbor.options[izbor.options.length] = new Option('C1220','C1220'); } } </script> </head> <body> <FORM name="form3"> <table width="439" height="139" border="1"> <tr> <td width="200" height="33"> <div align="center"> <select name="vrsta" size="1" onchange="setOptions(document.form3.vrsta.options [document.form3.vrsta.selectedIndex].value);"> <option value=" " selected="selected"> </option> <option value="okc">Opsti konstrukcijski celici</option> <option value="pc">Poboljsani celici</option> <option value="cc">Cementirani celici</option> <option value="cl">Celicni liv</option> <option value="sl">Sivi liv</option> </select> <br> <br> </div></td> <td width="108" rowspan="3"> </td> <td width="109" rowspan="3"> </td> </tr> <tr> <td height="33"><div align="center"> <select name="celik" size="1"> <option value=" " selected="selected">Izabrati prvo vrstu</option> </select> </div></td> </tr> <tr> <td height="23" rowspan="2"><div align="center"> <input type="button" value=" ok " onclick="beta(this.form)" /> </div> </div> <div align="center"></div> </td> </tr> <tr> <td><input type="type" "number" value="" name="ans15" size="9" /></td> <td><input type="type" "number" value="" name="ans14" size="9" /></td> </tr> </table> </FORM> </body> </html> I am trying to implement a linked list in javascript. So far i have: Code: function linkedList(){ var llNode=function(value){ this.next=null; this.previues=null; this.value=value; } var that=this; this.length=0; this.head=null; this.tail=null; this.add=function(value){ if(length==0){ var tmp=new llNode(value) that.head=tmp; that.tail=tmp; } else{ var tmp=new llNode(value); tmp.previues=that.tail; that.tail.next=tmp; that.tail=that.tail.next; } that.length++; } } } When I use: Code: var ll=new linkedList(); ll.add(1); ll.add(2); both the head and tail of ll point to the node whose value is to, and the next and previues pointer on that node are both null. Hi, am trying to populate my second list box from the 1st. I have done the folowing code, iam trying to call a function in the onchange event of my 1st listbox, but it does not change the URL however if i manually change my URL then the thing works fine. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <SCRIPT language=JavaScript> function reload(){ var val=form1.make.options[form1.make.options.selectedIndex].value; window.location='upload.php?cat=' + val ; } </script> </head> <body> <?php $host="localhost"; // Host name $username="******"; // Mysql username $password="******"; // Mysql password $db_name="******"; $con= mysql_connect("$host", "$username", "$password"); if (!$con){ die("cannot connect"); } mysql_select_db($db_name, $con); $sql1 = mysql_query("select * from make"); $cat=$_GET['cat']; //This line is added to take care if your global variable is off if(strlen($cat) > 0 and !is_numeric($cat)){//check if $cat is numeric data or not. echo "Data Error"; exit; } if(isset($cat) and strlen($cat) > 0){ $sql2=mysql_query("SELECT * FROM model where id=$cat"); }else{$sql2=mysql_query("SELECT * FROM model"); } echo "<form id='form1' name='form1' method='post' action=''>"; echo "<p>"; echo "<label>"; echo "<select name='make' id='make' onchange='reload()'>"; while($row1 = mysql_fetch_array($sql1)){ //echo "<option value=\"${row1['name']}\">${row1['name']}</option>"; echo "<option value='$row['name']'>$row['name']</option>"; } echo "</select>"; echo "</label>"; echo "</p>"; echo "<p>"; echo "<label>"; echo "<select name='model' id='model'>"; while($row2 = mysql_fetch_array($sql2)){ echo "<option value=\"${row2['name']}\">${row2['name']}</option>"; } echo "</select>"; echo "</label>"; echo "</p>"; echo "</form>"; ?> </body> </html> Thanks I wanted a custom look for my list menu. Here is what I came up with... http://schrene.web44.net/List-Menu.html I created it using divs with text overflow to get the scroll bar. Here is my code Code: <div id="colorList"> <center> <div class="mySelect" onClick="myFunction()">Abalone</div> <div class="mySelect" onClick="myFunction()">Acorn</div> <div class="mySelect" onClick="myFunction()">Adobe</div> <div class="mySelect" onClick="myFunction()">Allspice</div> <div class="mySelect" onClick="myFunction()">Antarctica</div> <div class="mySelect" onClick="myFunction()">Anthracite</div> <div class="mySelect" onClick="myFunction()">Aqualite</div> <div class="mySelect" onClick="myFunction()">Arctic Blueberry</div> <div class="mySelect" onClick="myFunction()">Arctic Ice</div> <div class="mySelect" onClick="myFunction()">Arctic Lime</div> <div class="mySelect" onClick="myFunction()">Cilantro</div> <div class="mySelect" onClick="myFunction()">Cinnabar</div> <div class="mySelect" onClick="myFunction()">Clam Shell</div> <div class="mySelect" onClick="myFunction()">Clove</div> <div class="mySelect" onClick="myFunction()">Cobalt</div> <div class="mySelect" onClick="myFunction()">Cocoa Brown</div> <div class="mySelect" onClick="myFunction()">Concrete</div> <div class="mySelect" onClick="myFunction()">Copperite</div> <div class="mySelect" onClick="myFunction()">Cottage Lane</div> <div class="mySelect" onClick="myFunction()">Designer White</div> <div class="mySelect" onClick="myFunction()">Doeskin</div> <div class="mySelect" onClick="myFunction()">Dove</div> <div class="mySelect" onClick="myFunction()">Earth</div> </center> </div> It worked great but it loses the scroll bar on iPhone. I want something that works for mobile web as well as traditional.. Does anybody have any ideas how to create a list menu like this??? Any help would greatly be appreciated I currently have a JavaScript function that works great except for what I am about to explain and wish that i can get it worked out by utilizing someones help in this forum. So, Here goes. I have 2 list boxes one that has a list of options and one empty. when I click the button between the two It places the values into the other box and vice versa which currently works fine. The thing is when I click the submit button to store that info from the list box to the empty box in a DB it does not record the value's as if the box was empty after I have already selected from the list. is there anyone that can help me in figuring this thing out, I would greatly appreciate it. Here is my code: JavaScript Code: <script language="javascript"> function validate_list() { if ( document.theForm.ToLB.value == "" ) { alert ( "Please select header column from the list box. " ); return false; }else return true; } function move(tbFrom, tbTo) { var arrFrom = new Array(); var arrTo = new Array(); var arrLU = new Array(); var i; for (i = 0; i < tbTo.options.length; i++) { arrLU[tbTo.options[i].text] = tbTo.options[i].value; arrTo[i] = tbTo.options[i].text; } var fLength = 0; var tLength = arrTo.length; for(i = 0; i < tbFrom.options.length; i++) { arrLU[tbFrom.options[i].text] = tbFrom.options[i].value; if (tbFrom.options[i].selected && tbFrom.options[i].value != "") { arrTo[tLength] = tbFrom.options[i].text; tLength++; } else { arrFrom[fLength] = tbFrom.options[i].text; fLength++; } } tbFrom.length = 0; tbTo.length = 0; var ii; for(ii = 0; ii < arrFrom.length; ii++) { var no = new Option(); no.value = arrLU[arrFrom[ii]]; no.text = arrFrom[ii]; tbFrom[ii] = no; } for(ii = 0; ii < arrTo.length; ii++) { var no = new Option(); no.value = arrLU[arrTo[ii]]; no.text = arrTo[ii]; tbTo[ii] = no; } } </script> Html Code: <table width="250" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100"> <select name="FromLB" size="26" style="width:200px" id="sourceSelect" multiple="multiple" ondblclick="move(this.form.FromLB,this.form.ToLB)"> <option value="Contract ID">Contract ID</option> <option value="Vendor ID">Vendor ID</option> <option value="Complete Upon Initial Receipt">Complete Upon Initial Receipt</option> <option value="Contract Complete">Contract Complete</option> <option value="Customer has Renewed">Customer has Renewed</option> <option value="Date Recieved">Date Recieved</option> <option value="Do Not Renew">Do Not Renew</option> <option value="Evergreen Clause">Evergreen Clause</option> <option value="GLB Compliant">GLB Compliant</option> <option value="GLB Sensitive">GLB Sensitive</option> <option value="Red Flag Sensitive">Red Flag Sensitive</option> <option value="Red Flag Compliant">Red Flag Compliant</option> <option value="Indefinite">Indefinite</option> <option value="Initial Termination">Initial Termination</option> <option value="Last File Upload">Last File Upload</option> <option value="M/N/A">M/N/A</option> <option value="Notice Date">Notice Date</option> <option value="Renewal Terms">Renewal Terms</option> <option value="Override Termination Date">Override Termination Date</option> <option value="Termination Date">Termination Date</option> <option value="Termination Letter Sent">Termination Letter Sent</option> <option value="Effective Date">Effective Date</option> <option value="Client">Client</option> <option value="Vendor">Vendor</option> <option value="Contract Completed Date">Contract Completed Date</option> <option value="Customer Desc">Customer Desc</option> </select> </td> <td width="100" align="center" valign="middle"> <input type="button" name="forward" id="button" style="width:95px" value="Add>>" onClick="move(this.form.FromLB,this.form.ToLB)"/> <br> <br> <input type="button" name="back" id="button" style="width:95px" value="<<Remove" onClick="move(this.form.ToLB,this.form.FromLB)"/> </td> <td align="left"> <select name="ToLB" id="ToLb" size="26" style="width:200px" multiple="multiple" ondblclick="move(this.form.ToLB,this.form.FromLB)"/> </select> </td> </tr> </table> Hello everyone, after a few days of looking i give up i just don't know what to look for or how to do it. on this website "http://www.hunlock.com/blogs/Everything_You_Ever_Needed_To_Know_About_Video_Embedding there is a section called How to make a video select list. I have been able to replicate and modify it to my liking how ever i have one issue. i can't make my videos fullscreen. The videos have and give the option for full screen but the fullscreen doesn't work. i prefer this kind of code because it allows my webpage to select a video without changing the webpage and play it, i find it much more smoother then then multiple embedded videos in tabs (i don't even know what to call it so thats what i call it) just incase the website doesnt work or something i will post the script first part<div id='videoPlayback' style='width: 435px; height:350px; background-color: #800000;'></div> then <div id='selectDemo1' style='display: none'> <object width="425" height="350"> <param name="movie" value="http://www.youtube.com/v/-is63goeBgc"></param> <param name="wmode" value="transparent"></param> <embed src="http://www.youtube.com/v/-is63goeBgc&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"> </embed> </object> </div> <div id='selectDemo2' style='display: none'> <object width="425" height="350"> <param name="movie" value="http://www.youtube.com/v/c6SHsF1n9Qw"></param> <param name="wmode" value="transparent"></param> <embed src="http://www.youtube.com/v/c6SHsF1n9Qw&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"> </embed> </object> </div> then <A HREF="#" onclick='return playVideo("selectDemo1","videoPlayback")'>RvD2: Ryan vs. Dorkman 2</A><BR> <A HREF="#" onclick='return playVideo("selectDemo2","videoPlayback")'>Beatboxing Flute </A><BR> and finally<script type="text/javascript"> function playVideo(sourceId, targetId) { if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);} if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);} targetId.innerHTML=sourceId.innerHTML; return false; } </script> i'm not sure the exact functions or how to write this kinda stuff from scratch so if you have any helpfull additions or suggestions please let me know. here is my function at the moment which gets some HTML: Code: function showRecent() { Ext.Ajax.request({ url: 'server.php?action=get', success: function(e) { var obj = Ext.util.JSON.decode(e.responseText); var pubs = obj.pubs; if (pubs) { var html = tpl.applyTemplate(pubs); Ext.getCmp('recentTab').update(html); } } }); } here is my HTML: Code: <div id="pubs" class="x-hidden-display"> <tpl for="."> <div class="detail"> <div class="clear"> <span class="span2 bottomright">{rsTown}</span> </div> <div class="clear"></div> </div> </tpl> <br/> <br/> <br/> </div> I'd like to show my data in a nested group list Please help?! So I have a list of values in an xml document. 1. Tom 2. Ned 3. Steve 4. Bob 5. Rob If I leave/refresh the page, I start back at the 1st entry (Tom). I would like to return the viewer to where the viewer left off. Example, if user exists at Steve, I would like to resume him when he returns at Bob. Is this possible using Javascript/XML? I am working on a website that involves a pizza. I have a drop down box with the following options: small, medium, large, and extra large. When the user selects small the topping price is $0.75 each, when the user selects medium the topping price is $1.00 each, when the user selects large the topping price is $1.25 each, and when the user selects extra large the topping price is $1.25 each. I the problem is no matter what size the user selects the topping price is always $0.75. Here is code that goes with the drop down box : Code: <td height="49" align="right"><label for="Pizza_Size">Size</label> <select name="Pizza_Size" id="Pizza_Size" onchange = "SetToppingPrice()" /> <option value="Small_Pizza">Small ($4.99)</option> <option value="Medium_Pizza">Medium ($5.99)</option> <option value="Large_Pizza">Large ($7.99)</option> <option value="X_Large_Pizza">X-Large ($10.99)</option> </select></td> Here is the Javascript code: Code: // JavaScript Document function SetToppingPrice() { var Pizza_Topping_Price = document.getElementById("Pizza_Size"); divOutput = document.getElementById("Display_Topping_Price"); if(Pizza_Topping_Price = "Small_Pizza") { divOutput.innerHTML = "$0.75 per topping";} else if (Pizza_Topping_Price = "Medium_Pizza") { divOutput.innerHTML = "$1.00 per topping";} else if (Pizza_Topping_Price = "Large_Pizza") { divOutput.innerHTML = "$1.25 per topping";} else if (Pizza_Topping_Price = "X_Large_Pizza") { divOutput.innerHTML = "$1.50 per topping";} } Any advice is greatly appreciated. It adds fine when any number but 12.3 is used if 12.3 is used however it gives 54.099999999999994 var liu = [10.6,11.2,9.4,12.3,10.1]; var calculateTotal= function(raceTimes){ var totalTime; var raceTime = raceTimes[0]; var i =0; for (i = 0; i< 4; i++){ raceTime = raceTime+raceTimes[i]; totalTime = raceTime; } return totalTime; }; var liuTotal = calculateTotal(liu); console.log(liuTotal); |