JavaScript - This Thread Needs Deleting
I made a new thread for a problem that I solved a little after posting so I have removed the question in order to not waste anyone's time
Similar TutorialsDelete this post. Thank you
Is their anyway to have a tight loop of code long for a long period of time without freezing the page? I want to be able to do: Code: for (i=0;i<9999999999;i++){ //some code if (i%100==0){ yield(); } } hi, deleted old thread, since that didn't answer problem. posting code because of all the dynamic variables would be confusing. so, if anyone can help, here's some link instructions: 1) go to http://www.vehicle411.com 2) in the "vehicle classifieds" panel just click "search" which will bring up 68 vehicles. 3) click on link for any vehicle, which will display vehicle information in a popup window. up to this point everything is fine. BUT when you click the popup's "connect" button to link to a dealership the new window is undersized (actually, if it replaced the original vehicle411 window that would be fine). have tried a lot of different combinations, including the <a href="javascript:photowindow('dealerurl')"> suggested in the other post gives weird result showing javascript:photowindow('dealerurl') in the address window instead of the actual url--meaning it doesn't call the photowindow function. P.S. if you look at the source--all the server values are passed correctly and don't interfere with the code. right now, I've got a simple <a href="dealerurl"> instead of the JS method. Also, have hard coded values to make sure dynamic stuff was working-- and they work. what's really annoying is that I've used just about the same JS code to create that vehicle popups. P.P.S. went back and changed code to using <a href="#" etc. which doesn't work either. but have a direct url for anyone reading this (when clicking on "connect" button it's just creating a copy of itself!!! http://www.vehicle411.com/_system/di...9765108&cid=1# ok ive been searching for a way to make it so when i click on a link it brings up an image or text box...and then when you click on another link on the same page that text box fades out and the new one fades in... i know how to make images fade in and out and i can make them overlap each other and everything...but making it so i can click either as many times as i want and they keep overlapping is a bit outside my scope sorry...but through my scowering of this forum i found an old post on this thread he http://codingforums.com/showthread.php?t=171655 where a user "spudhead" posted what i think im looking for...but it didnt work for me when i tried it... again, sorry if this isnt how you post idk im new here =/ i was going to post on the old thread but i wasnt sure if it would be answered... thanks for the responses... Hi all, working on building a website at the moment. and i need to create a script that will increment a number by 0.01, then stop and decrease by 0.03, then increase again by one. I wrote code to increment by 0.01 continuouly but now i can't stop it. and change to decreasing <script type = "text/javascript"> num = 0.87; var tim = 0; function makeNum() { num = ((num*1) + .01).toFixed(2); document.getElementById('count').innerHTML = num-.01; tim = window.setTimeout("makeNum()", 2000); } makeNum(); </script> And now I'm Completly stuck. Help would be grately appreciated Thanks Hi guys, I'm looking for a way i can set some of the mailto form data - mainly the full name and holiday start date into the subject line of the email. this is the code for my form: Code: <html> <head> <body bgcolor="#DCDCDC"> <font size="3" face="tahoma" color="#000000"> <form action="MAILTO:email@email.co.uk?subject=Holiday Request" method="post" enctype="text/plain" font-weight: bold; size="10" maxlength="30"> <u><b>Holiday Request Form</b></u> <br /><br /> First Name: <input type="text" name="first-name" /> <br /><br /> Last Name: <input type="text" name="last-name" /> <br /><br /> Holiday Type: <select name = "Holiday Type"> <option value="new holiday">New Holiday</option> <option value="amend holiday">Amend Holiday</option> <option value="delete holiday">Delete Holiday</option> </select> <br /><br /> Start Holiday: <select name = "Start Day"> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> / <select name = "Start Month"> <option value="january">Jan</option> <option value="febuary">Feb</option> <option value="march">Mar</option> <option value="april">Apr</option> <option value="may">May</option> <option value="june">Jun</option> <option value="july">Jul</option> <option value="august">Aug</option> <option value="september">Sep</option> <option value="october">Oct</option> <option value="november">Nov</option> <option value="december">Dec</option> </select> / <select name = "Start Year"> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> </select> <br /><br /> End Holiday: <select name "End Day"> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> / <select name = "End Month"> <option value="january">Jan</option> <option value="febuary">Feb</option> <option value="march">Mar</option> <option value="april">Apr</option> <option value="may">May</option> <option value="june">Jun</option> <option value="july">Jul</option> <option value="august">Aug</option> <option value="september">Sep</option> <option value="october">Oct</option> <option value="november">Nov</option> <option value="december">Dec</option> </select> / <select name = "End Year"> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> </select> <br /><br /> Total Hours Required: <input type="text" name="total-hours" size="6"/> <br /><br /> Notes Box: <br /> <textarea name="Additional Info" rows="5" cols="40"> Enter here any additional information that may be required. </textarea> <br /><br /> Half Day Tickbox: <input type="checkbox" name="half-day" value="half-day"/> <br /><br /> Start Shift: <select name = "Start Shift Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "Start Shift Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> End Shift: <select name = "End Shift Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "End Shift Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> Lunch Start: <select name = "Lunch Start Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "Lunch Start Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> Lunch End: <select name = "Lunch End Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "Lunch End Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> Holiday Start Time: <select name = "Holiday Start Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "Holiday Start Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> Holiday End Time: <select name = "Holiday End Hours"> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> </select> : <select name = "Holiday End Minutes"> <option value="00">00</option> <option value="15">15</option> <option value="30">30</option> <option value="45">45</option> </select> <br /><br /> <input type="submit" value="Send"> </form> </font> </body> </head> </html> Any help will be appreciated. Thanks, Craig i create cookies that contain multiple values using Jquery cookie plugin e.g, $.cookie('biz', ['foo', 'bar', 'lact'], {path: '/', expi 7}); from this url http://localhost/categories/educatio...r/universities and use a.remove('foo'); to remove the value after splitting, before removing value i count the number of value and if one remains to delete the cookie 'biz' entirely, even though i could remove the values, one always remains which cannot be remove from this url but only from http://localhost/categories i use .htaccess to rewrite the url, function of remove is : Array.prototype.remove=function(s){ var i = this.indexOf(s); if(i != -1) this.splice(i, 1); } please help I have created a calculator for my site but I am having troubles figuring out a way to make the "add row" and "delete row" functionality work correctly. I would like the user to only see 1 row of information and then add/delete rows as needed. I currently only have 4 static rows. If anyone can help it would be greatly appreciated. Thanks The page is at https://learningportal.juniper.net/j...lator/Calc.htm How can I to delete white spaces around parameter that I to pass with HTML forms. For example, if I have 'firstname lastname ' or ' firstname lastname', exist it a builtin function in javascript to obtian 'firstname lastname'? savio I writed the following HTML code: Quote: <html> <head> <title>Pagina di Prova</title> <script type="text/javascript" src="/home/savio/Scrivania/prova.js"></script> </head> <body> <h1 align="center">PROVA DI RIMOZIONE DI RIGHE E CELLE DALLA TABELLA</h1> <br/><br/> <table id="nometabella" border="2" align="center" cellpadding="10%"> <tr id="nomeriga1"><td>Cella 1</td><td>Cella 2</td></tr> <tr id="nomeriga2"><td>Cella 3</td><td>Cella 4</td></tr> <tr id="nomeriga3"><td>Cella 5</td><td>Cella 6</td></tr> </table> <input type="submit" value="Enter" onclick="return del()"/> </body> </html> and the following javascript code: Quote: function del() { if (document.getElementById) { var tabella = document.getElementById("nometabella"); var riga1 = document.getElementById("nomeriga1"); tabella.removeChild(riga1); } } I want to delete first row of table, but it happens nothing. How can solve this problem? My table had the following layout. Code: <table> <tr> <td rowspan='2'><td> <td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> </table> After clicking an add rows button, the two rows are cloned and appended as follows with a checkbox added as shown. Code: <table> <td rowspan='2'><td> <td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td rowspan='2'><input type='checkbox' name='check'><td> <td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> </table> I want to be able to delete rows 3&4 by selecting the checkbox in row 3 and clicking a delete rows button. Regardless of how many sets of rows have been previously added, any set of rows can be deleted by selecting the appropriate checkbox(es) and clicking delete button. I'm trying to figure out how this can be done. My thinking is if checkbox is checked, calculate row index. I would then have to call deleteRow twice on that row index. Is there a better way of doing this? My table starts like this: Code: <table> <tr> <td rowspan='2'></td><td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> </table> When an addRows button is clicked, the first two rows are copied (cloned), a checbox is then inserted into the row1 cell1, then the two rows are appended: <table> <tr> <td rowspan='2'></td><td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td rowspan='2'><input type='checkbox' name='check[]'></td><td>Data</td><td>Data</td><td>Data</td> </tr> <tr> <td>Data</td><td>Data</td><td>Data</td> </tr> </table> Rows,except the first two can then be deleted by selecting the appropriate checkbox and clicking a deleteRow button. The check[] only exists after the first two rows have been copied and appended, so undefined means only two rows exist. Having a problem with the while loop. If a browser sees the next sibling of a tr as a td, the the loop should force the browser to go to the next sibling until its a tr, i.e row4. But its causing my browser(FF) to become unresponsive. Code: function deleteRow() { if(check == 'undefined') { return; } else { var check = document.getElementsByName('check[]'),row,nextRow,x; var len = check.length; for(x=len-1; x>=0; x--) { if(check[x].checked) { row = check[x].parentNode.parentNode; while(row.nextSibling.nodeName != 'tr') { nextRow = row.nextSibling; } nextRow = row.nextSibling; alert('ok'); } } } } Appreciate ans help with this? Say I have a <textarea> input and I want to strip all the blank lines (lines with only whitespace). I have this regular expression, why doesn't it do anything? I've tried different variations with the flags (m and g). Code: ... var output = input.replace(/^\s*$/gm, "notworking!"); ... The very same regex works fine in my text editor (Notepad2), and I can match all empty lines. Code: LINE1 LINE4 ^(line 3 has some spaces) should become Code: LINE1 LINE4 And when I finally do get this to work, how would I remove the empty line? Our site allows the user to specify his or her location, which is then stored in a cookie. As the user navigates from page to page on the site, this location is remembered. The user also has the option of changing their location. This calls a javascript function which sets the value of that location cookie to "". When another function sees that the value is "" of that cookie, it brings back the location selector. Then the user can start over and choose a location. Here's the problem: Let's say I'm on page 1 of the site and I choose location A. Then I navigate to page 2. On page 2, I say I want to change my location. Now the page shows me the location selector instead of saying that I am in location A. So far, so good. However, if I now navigate back to page 1, it thinks I am still in location A. the cookie was deleted for page 2, but still remembered for page 1. It isn't a cache issue; if I reload the page, page 1 will still say that I am located in location A, even though on page 2, I elected to delete that cookie (or to set its value to ""). What is a better way to delete cookie so that if I were to navigate back to a page on which I'd previously set the cookie, it will now know that the value is the new value (""), and not the value I'd originally set the first time I visited the page? THANK YOU! EDIT: Post deleted
I wrote a script that should delete all table rows at once. For loop deletes all rows except row 1 and row 3. Further clicking on the delete button, deletes row 1 and then 3. While loop ,on the first click on the delete button, also leaves rows 1 and 3 not deleted. Further clicking on the delete button, does not delete these rows. I was sure that both version of the script should delete all rows in the table at once. Could someone look at the script and tell me what is wrong? Thank you very much Code: <html> <head> <title>Deleting All Table Entries</title> </head> <script type="text/javascript"> /* WHILE LOOP var i=0; function deleteAll() { document.getElementById("deleteButton").onclick=function() { var table=document.getElementById("myTable"); while(i<table.rows.length) { table.deleteRow(i); i++; } } } */ /*FOR LOOP*/ function deleteAll() { document.getElementById("deleteButton").onclick=function() { var table=document.getElementById("myTable"); for(var i=0; i<table.rows.length; i++) { table.deleteRow(i); } } } window.onload=deleteAll; </script> <body> <table id="myTable"> <tr> <td>Row 0</td> </tr> <tr> <td>Row 1</td> </tr> <tr> <td>Row 2</td> </tr> <tr> <td>Row 3</td> </tr> <tr> <td>Row 4</td> </tr> </table> <button id="deleteButton"> Delete All Rows in the Table </button> </body> </html> Hi all.I found this code on a forum to confirm that the user wants to delete the record from database and that the link has not pressed accidently.But it is not deleting the record even after pressing ok.This is may be because the id is not passed properly. Can anyone tell why?Do I need to modify the javascript function?Here is my code: Code: function confirmation() { var answer = confirm("Delete Record?") if (!answer){ window.location = "by_hand.php"; } else { window.location = "delete.php?delete=$id&action=deleteemployee"; } } PHP Code: <a href=# onclick='confirmation()'><img src='images/delete.png' alt='Delete' title='Delete' class='pngfix'></a> |