JavaScript - Concurrency Problems With Js
Can you guys help me...I'm stuck.....I've simplified it as much as I can....
Code: var insertLocked = false; var deleteLocked = false; function graphMove(direction){ dostuff(direction); waitLocked(); alert(insertLocked); } function waitLocked(){ if (insertLocked == true || deleteLocked == true){ setTimeout(waitLocked(), 200); } } dostuff() sets insertLocked and deleteLocked to true, then does a bunch of stuff and then sets them to false. When I run graphMove, it will go through everything and simply alert true. What I want it to do is hit waitLock, loop around in there until both insertLocked and deleteLocked are set to false and then continue on, in this case outputing alert(insertLocked) as false. Please help!!! - J Similar Tutorialshi am studying for a exam an i have some problems. Just wanted to get an idea when is it more appropriate to use a for than a while loop? how much work is a loop performing? what is the fewest times a loop will perform its body? how many times will a loop perform its body? (as a function of a constant and of a variable) insidehb.com/main/imageofday/aug16to31/aug16to31.htm 1. the "visit henrbuilt" link is in the wrong position (its supposed to be centered) 2. there are too many thumbnails for "aug 16 - 31" so i had to redo "thumbs_mask.gif" (which makes the gray and clear thing at the bottom that moves) so that it was longer and covered all the thumbnails. now that is is 400 px longer, the center of it moved 200px to the right and i cant get it to move 200px to the left. i would i guess it has to do with my style sheet (insidehb.com/main/imageofday/aug16to31/style13.css) but it could also have to do with my main html page (insidehb.com/main/imageofday/aug16to31/aug16to31.htm) 3. its still being messed up in IE even with a new doctype I am putting together a quiz in the form of a game, and I have tested the code for problems, and found a big one. Here is a part of my code that doesn't work- it always goes to "Sorry, incorrect", even when I type in 2.37. Code: var x=document.getElementById("varsource1"); if (x==="2.37") { alert("Correct."); (More code here) } else if(x !== "2.37") { alert("Sorry, incorrect."); } If anyone wants my whole code, I can put it up later, if you ask me for it. i have 3 different problems: 1. I was trying to make is display Kentucky Resident yes is the box is checked and nothing if it is not checked. 2. while trying to add this in I messed something up and not the alert will not display anything at all. 3. last time I click the button the play load a page error and i have no idea why. any and all help would be appreciated. thanks. Code: <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>EKU</title> <script type="text/javascript"> //<![CDATA[ function valStudent() { var lastName = document.frmStudentInfo.txtLastName.value; var firstname = document.frmStudentInfo.txtFirstName.value; var mi = document.frmStudentInfo.txtS_Mi.value; var address = document.frmStudentInfo.txtS_Add.value; var city = document.frmStudentInfo.txtS_City.value; var state = document.frmStudentInfo.txtS_State.value; var zip = document.frmStudentInfo.txtS_Zip.value; var phone = document.frmStudentInfo.txtS_Phone.value; var dob = new Date (document.frmStudentInfo.txtS_Dob.value); var selectAdvisor = document.frmStudentInfo.lstF_ID.selectIndex; var res = document.frmStudentInfo.chkResident.value; var stuClass; var classChecked = false; for (var i=0; i < document.frmStudentInfo.optS_Class.length; i++) { if (document.frmStudentInfo.optS_Class[i].checked) { classChecked = true; stuClass = document.frmStudentInfo.optS_Class[i].value; } } if (lastName == "") { alert ("Please enter a last name"); document.frmStudentInfo.txtLastName.select(); return false; } else if (firstname == "") { alert ("Please enter a first name"); document.frmStudentInfo.txtFirstName.select(); return false; }else if (address == "") { alert ("Please enter a address"); document.frmStudentInfo.txtS_Add.select(); return false; } else if (city == "") { alert ("Please enter a city"); document.frmStudentInfo.txtS_City.select(); return false; } else if (state == "") { alert ("Please enter a state"); document.frmStudentInfo.txtS_State.select(); return false; } else if (zip == "") { alert ("Please enter a zip"); document.frmStudentInfo.txtS_Zip.select(); return false; } else if (phone == "") { alert ("Please enter a phone"); document.frmStudentInfo.txtS_Phone.select(); return false; }else if (dob == "NaN") { alert ("Date of Birth is not valid, use MM/DD/YYYY to enter data"); document.frmStudentInfo.txtS_Dob.select(); return false; }else { alert ("Last name: " + lastName + "\n" + "First Name: " + firstname + "\n" + "mi: " + mi + "\n" + "Address: " + address + "\n" + "City: " + city + "\n" + "State: " + state + "\n" + "Zip: " + zip + "\n" + "phone: " + phone + "\n" + "Date of Birth: " + dob + "\n" + "Advisor " + document.frmStudentInfo.lstF_ID.text(selectAdvisor).text + "\n" + "classfication " + stuClass); return true; } } //]]> </script> </head> <body> <table width="70%" align="center"> <tr> <td><img src="nwlogo.jpg" width="196" height="93" alt="** PLEASE DESCRIBE THIS IMAGE **" /></td> <td> <h2>Student Information</h2> </td> </tr> </table> <form name="frmStudentInfo" action="action%20marker" id="frmStudentInfo"> <table align="center"> <tr> <td> Last Name:</td> <td><input type="text" name="txtLastName" size="20" /></td> <td></td> <td> </td> <td> <h4>Class:</h4> </td> <td></td> </tr> <tr> <td> First Name:</td> <td><input type="text" name="txtFirstName" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Freshman" /></td> <td>Freshman</td> </tr> <tr> <td> MI:</td> <td><input type="text" name="txtS_Mi" size="5" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Sophomore" /></td> <td>Sophomore</td> </tr> <tr> <td> Address:</td> <td><input type="text" name="txtS_Add" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Junior" /></td> <td>Junior</td> </tr> <tr> <td> City:</td> <td><input type="text" name="txtS_City" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Senior" /></td> <td>Senior</td> </tr> <tr> <td> State:</td> <td><input type="text" name="txtS_State" size="5" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Graduate" /></td> <td>Graduate</td> </tr> <tr> <td> ZIP Code:</td> <td><input type="text" name="txtS_Zip" size="20" /></td> <td> </td> <td></td> <td></td> </tr> <tr> <td> Phone:</td> <td><input type="text" name="txtS_Phone" size="20" /></td> <td> </td> <td>:<input name="chkResident" type="checkbox" /></td> <td> Kentucky Resident</td> </tr> <tr> <td> Date of Birth:</td> <td><input type="text" name="txtS_Dob" size="20" /></td> <td> </td> <td>Advisor</td> <td><select size="1" name="lstF_ID"> <option selected="selected">1 (Chuck Lin)</option> <option>2 (Chris Blades)</option> <option>3 (Steve Loy)</option> <option>4 (Bob Mahaney)</option> <option>5 (Ted Randles)</option> </select></td> </tr> <tr> <td></td> <td><input type="submit" value="Submit" onclick="valStudent()" /></td> </tr> </table> </form> </body> </html> Hi: Code below works fine in Firefox and Firebug shows no problems. Code: function changePlaylist(newplaylist,no_of_items) { playerConfig.playlist = []; for(var i = 0; i < no_of_items; i++) { playerConfig.playlist[i] = newplaylist; } setTimeout("createPlayer()",1); //delay create player to allow playlist to "stabilize" mediaPlayer.play(); // play the newly loaded playlist sequence* } IE9 script debugging (attached file) indicates problems with mediaplayer.play(). Even so it plays a movie. When I try playing a different movie in IE 9 nothing happens. Like I said works fine in Firefox and worked fine in IE 8. I called MS about problems with IE 9 security stuff etc. Talked with a guy in Bangladesh or some place over a bad connection who said they were gathering bug information (as usual with MS). All the dialogs where you can "allow scripting" etc. etc. have been replaced with some mindless stuff (as usual for MS). Anyway, are there some workarounds for IE9 problems? I need what this... Code: $('#gatewayDimmer').width($('html').width()); $('#gatewayDimmer').height($('html').height()); $('#gatewayDimmer').css('display','block'); ...is controlling to occupy the full screen/scrollable window. In FireFox, it does except for maybe...11px thats initially under the vertical scrollbar(when you use the horizontal scrollbar and scroll right, you can see the area under the vertical scrollbar was never occupied). In IE(7 at least), it occupies everything in the initial window, even the area underneath the vertical & horizontal scrollbars, but after scrolling down past the area the horizontal scrollbar would've covered, it doesn't occupy anything(it stops). I need every inch, pixel, etc. covered, from head to toe. To lock it, if you will. Is there something I can add, change here? Thanks in advance I need a jump menu, that when an item is selected the next jump menu pops up with more selections to be made is this possible? Hi and firstly thank you in advance as I've just joined this forum in search of technical help. I am working on a website and having some problems with javascript that creates tabbed content on a page. The script is a free script from http://nuevvo.com/labs/simpletabs/. The problem is that the page with the script is not showing properly. The issue seems to only happen in Internet Explorer. The site was created on a development server and then copied over to the current hosting. The page appeared fine on the development server but when transferred to the new server the problem showed up. Please look at the following in Internet Explorer: This is how the page should look: http://www.sourcescotland.com/nobles...ing-times.html But on the new server it looks like this: http://www.galleyoflorne.co.uk/noble...ing-times.html The code is he Code: <script type="text/javascript" src="scripts/simpletabs_1.3.packed.js"></script> The actual code file is he http://www.galleyoflorne.co.uk/noble..._1.3.packed.js I would be willing to offer paid help if this is necessary. Or at least get to know you so that I can offer you work in future. I don't have anyone on my team yet that specialises in Javascript. thanks so much, Deb Why will scripts run in IE and not in firefox. I cant find any simple Javascript code that will create a username/password login that will work in both browsers.
I'm still not quite sure if I'm posting in the right place! I was using FireFox to design a page with a drop down box to select four different links. the script works just fine in FireFox but does nothing in IE8. Does anyone have any suggestions??? Script: <form action="../"> <select onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option value="">Choose a destination...</option> <option value="./Marrgolf_european_open.html">European OPEN</option> <option value="./Marrgolf_US_open.html">U.S. OPEN</option> <option value="./Marrgolf_masters.html">MASTERS</option> <option value="./Marrgolf_PGA.html">PGA</option> <option value="./Blank_page.html">Reserved</option> </select> </form> I'm currently in the process of updating our old website as the layout is just terrible and it's hard to find products on it. This new layout has drop down menus, accordion menus and an image enlarger all from JavaScript. They work wonders in Firefox and Google chrome but, as usual, Internet Explorer has decided not to load it right for me. I've got several problems... Images won't show up most of the time Not able to click on linked images and the links from the drop down menu Accordion menu won't work, it just displays as one long sidebar When it does work, it shows a big gap between each main header rather than keeping them close together The drop list from the drop down menu hides behind the accordion menu Is there anything I can do that makes IE accept the javascripts? Unfortunately the new layout isn't up live so I've nothing you can link to. However, if there's any coding that you need I'll be more than happy to post it on. Thanks for your time! I am creating a shopping cart application that stores and retrieves cookies. I have two pages created. the first page has a table containing two rows, in which the user checks that item, and enters in the quantity. after the user selects one or both items and enters in the quantity, they click the button Add to cart, which stores this as a cookie. when the user clicks the view cart link, it brings them to view what they ordered in a table. my problem is, when the user clicks on the view cart link, how do i get the table to be displayed as the item name in the first column, the quantity in the second column, price in the third column, and the total for that item in the last column? here is the code for both my pages Code: <html> <head> <title> Store </title> <h1> My store </h1> <script type="text/javascript"> function setCookie() { var exdate = new Date(); exdate.setDate(exdate.getDate() +10); document.cookie = "price="+ document.getElementsByName("Price")[0].value + ";expires="+exdate.toGMTString(); } function retrieve() { document.getElementsByName("fullName")[0].value = document.cookie; } function Calc() { if (document.getElementById("calcu")){ var pri = document.getElementById("price").value; var qty = document.getElementById("quantity").value Total(pri,qty) } } function Total(pri, qty) { var pri = document.getElementById("price").value var qty = document.getElementById("quantity").value if (document.getElementById("circle").checked) { document.getElementById("total").value = pri * qty } } functino load() { document.getElementById("circle") } </script> </head> <body> <table border = "1"> <td> <input type="checkbox" id = "circle"> Circle </td> <td> <img src="circle.jpg"> </td> <td> Price: <input type = "text" size = "4" name = "price" />$ </td> <td> Quantity: <input type = "text" size = "4" id = "quantity"/> </td> <tr> </tr> <td> <input type = "checkbox"> Stickman </td> <td> <img src = "stickman.gif"> </td> <td> Price: <input type = "text" size = "4" value = "$" id = "price" /> </td> <td> Quantity: <input type = "text" size = "4" id = "quantity" /> </td> </table> <br /> <input type = "button" value = "Add to cart"> <br /> <br /> <a href ="cart.html" onclick = "retrieve()"> View Cart </a> <br /> <input type = "text" size = "8" id = "total"readonly = "readonly" /> Total <br /> <input type = "button" id = "calcu" value = "calc" onclick = "Calc()" /> </body> </html> Code: <html> <head> <title> Cart </title> <h1> My cart </h1> <script type = "text/javascript"> function retrieve() { document.getElementsByName("price")[0].value = document.cookie; } </script> </head> <body> <table border = "1"> <td> Stickman </td> <td> <script type = "text/javascript">document.getElementById ("price") </script> </td> <td> price per </td> <td> total </td> <tr> </tr> <td> Circle </td> <td> quantity order </td> <td> price per </td> <td> total </td> <tr> </tr> <td colspan = "3"> TOTAL: </td> <td> total price </td> </table> <br /> <br /> <script type="text/javascript">document.write(retrieve("price")); </script> <br / > <br /> <input type = "button" value = "Checkout"> <br /> <br /> <a href = "store.html"> Continue Shopping </body> </html> for this code, where it says quantity ordered, its supposed to display the quantity the user entered. price per is displaying the price, and where it says total, the total of that item. I have this form I am trying to get right but I am very stuck! I have looked this up all over the Internet and the answers conflict too much, I need your expertise please. My HTML is: Code: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>GPS-ware Order Form</title> <link href="gps.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="form.js"></script> </head> <body> <form id="orders" method="post" action="done.htm"> <div id="links"> <a href="#" class="newgroup">Home Page</a> <a href="#">Product Catalog</a> <a href="#">Order Form</a> <a href="#">Maps Online</a> <a href="#">Contact Us</a> <a href="#" class="newgroup">Countries</a> <a href="#">States</a> <a href="#">National Parks</a> <a href="#">Hiking Trails</a> <a href="#">Cities</a> <a href="#">Astronomical</a> <a href="#">Natural</a> <a href="#" class="newgroup">GoMap 1.0</a> <a href="#">Drive Planner 2.0</a> <a href="#">Hiker 1.0</a> <a href="#">G-Receiver I</a> <a href="#">G-Receiver II</a> <a href="#">G-Receiver III</a> <a href="#" class="newgroup">Downloads</a> <a href="#">Tech Support</a> <a href="#">FAQs</a> </div> <div id="main"> <p id="logo"><img src="gpsware.jpg" alt="GPS-ware" /></p> <h1>Order Form</h1> <p id="datep"> <input class="text" id="date" name="date" size="11" value="mm-dd-yyyy" tabindex="-1" readonly="readonly" /> </p> <fieldset> <legend>Enter the quantity of each item and press the Tab key</legend> <table cellspacing="2"> <tr><th class="label">Product</th><th>Price</th> <th>Quantity</th><th>Cost</th></tr> <tr> <td class="label">GoMap 1.0</td> <td><input name="price1" id="price1" size="8" value="19.95" tabindex="-1" readonly="readonly" /> </td> <td><input name="qty1" id="qty1" size="8" value="0" /> </td> <td><input name="cost1" id="cost1" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="label">Drive Planner 2.0</td> <td><input name="price2" id="price2" size="8" value="29.95" tabindex="-1" readonly="readonly" /> </td> <td><input name="qty2" id="qty2" size="8" value="0" /> </td> <td><input name="cost2" id="cost2" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="label">Hiker 1.0</td> <td><input name="price3" id="price3" size="8" value="29.95" tabindex="-1" readonly="readonly" /></td> <td><input name="qty3" id="qty3" size="8" value="0" /> </td> <td><input name="cost3" id="cost3" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="label">G-Receiver I</td> <td><input name="price4" id="price4" size="8" value="149.50" tabindex="-1" readonly="readonly" /></td> <td><input name="qty4" id="qty4" size="8" value="0" /> </td> <td><input name="cost4" id="cost4" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="label">G-Receiver II</td> <td><input name="price5" id="price5" size="8" value="199.50" tabindex="-1" readonly="readonly" /></td> <td><input name="qty5" id="qty5" size="8" value="0" /> </td> <td><input name="cost5" id="cost5" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="label">G-Receiver III</td> <td><input name="price6" id="price6" size="8" value="249.50" tabindex="-1" readonly="readonly" /></td> <td><input name="qty6" id="qty6" size="8" value="0" /> </td> <td><input name="cost6" id="cost6" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr><td class="col4" colspan="4"> </td></tr> <tr> <td class="col3" colspan="3">Sales Tax (5%)</td> <td><input name="tax" id="tax" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="col3" colspan="3"> <select id="shipping" name="shipping"> <option value="0">Choose a shipping option</option> <option value="4.95">Standard (4-6 business days) $4.95</option> <option value="8.95">Express (2 days) $8.95</option> <option value="12.95">Next Day (1 day) $12.95</option> </select> </td> <td><input name="shipcost" id="shipcost" value="0.00" size="12" tabindex="-1" readonly="readonly" /> </td> </tr> <tr> <td class="col3" colspan="3">TOTAL</td> <td><input name="total" id="total" size="12" value="0.00" tabindex="-1" readonly="readonly" /> </td> </tr> </table> </fieldset> <p id="pbuttons"> <input type="reset" value="Reset" /> <input type="submit" value="Submit Order" /> </p> </div> </form> </body> </html> This may seem like a very noob-like question but I just can't figure it out! I am new to Javascript and I was playing around with if...else.. statements. I made this little code to see if I can make a password activated code. In this case I just want it to open an alert window if the right password is put in. I have tried running this in Chrome, IE and Firefox and none of them worked. Code: <script type="text/javascript"> var n1=prompt("Please enter the correct password."); if (n1=1147) { alert("Congrats! You guessed the right password!"); } else { alert("I am sorry"n1" is not the correct password. Please try again"); } </script> Hello. I have the following: bottomCell.innerHTML = "apples 0"; bottomCell.innerHTML.replace("apples", "oranges", "gi"); The first line works fine, the second one doesn't. In the end, I want it to replace all instances of the numerical variable named myNumber to the string "t" + newNumber (where newNumber is another numerical variable) but neither this, nor the above mentioned line work. Any ideas? Thanks! Hey all. I am trying to remove a child node from an XML document and running into issues. I keep getting errors about not being able to find the child node, even though it very clearly exists. This is my XML http://www.digitalswordsmen.com/at/map11.xml I have tried the code //XML is a reference to my XML, go figure. var ID = 0; var y=XML.getElementsByTagName("id")[ID]; //This line works... alert(y.childNodes[0].nodeValue); //This fails XML.documentElement.removeChild(y); This is the exact error: Error: uncaught exception: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "http://www.digitalswordsmen.com/at/mapFunctions.js Line: 373"] but to no avail. I think the issue is that most examples I've tried to follow only have the root element, then the nodes, but I have a root element, then another level (mapSettings & mapObjects). I don't know how to tell the remove child command that it needs to look in the mapObjects section. I'm totally stuck. Any help is appreciated. Thanks. Code: <!-- function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } //--> </script> <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Test Page</a></h1> <form id="form_250840" class="appnitro" method="post" action=""> <div class="form_description"> <h2>TEST PAGE</h2> <p>QUESTIONNAIRE</p></div><ul> <div id="li_17" > <label class="description" for="element_17">Sample Question 1? </label> <input type="radio" id="element_17_yes" name="element_17" class="element radio" value="yes" onclick="document.getElementById('li_17a').style.display='block';" /> <label class="choice" for="element_17_yes">Yes</label> <input type="radio" id="element_17_no" name="element_17" class="element radio" value="no" checked="checked" onclick="document.getElementById('li_17a').style.display='none';" /> <label class="choice" for="element_17_no">No</label> </div> <div id="li_17a" > <label class="description" for="element_17a">Sample Question 2? </label> <span><input id="element_17_1a" name="element_17a" class="element radio" type="radio" value="1" /> <label class="choice" for="element_17_1a">Yes</label> <input id="element_17_2a" name="element_17a" class="element radio" type="radio" value="2" checked="checked"/> <label class="choice" for="element_17_2a">No</label></span> </div> <li class="buttons"> <input type="hidden" name="form_id" value="250840" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> Ok, my problem I seem to be having is that I want "sample question 2" to be invisible unless someone answers yes to "sample question 1". I've tried coding an onclick script into the radio buttons but I can't seem to get it working. I know this shouldn't be that difficult. Anyone know how to fix it? I have your typical AJAX function that doesn't seem to be working quite well. :< Here's the relevant portion of the StateChange function: Code: function StateChange() { if(ttajax.readyState==4) { xmlDoc=ttajax.responseXML; if (!xmlDoc) {return;} var x=xmlDoc.documentElement.childNodes; var AlertVal = ''; for (var i=0;i<x.length;i++) { if (x[i].nodeType==1) { AlertVal += x[i].nodeName + ": " + x[i].firstChild.nodeValue + "\n"; // AlertVal += x[i].nodeName + ": " + x[i].childNodes[0].nodeValue + "\n"; } } alert(AlertVal); var gameid = xmlDoc.getElementsByTagName('gameid')[0].childNodes[0].nodeValue; // Other **** } } Note the testing function there... It DOES return the Node Name! However, the firstChild/childNodes[0] is "null", and I cannot pull the nodeValue from it. :< Here is a sample XML bit it's being tested on: Code: <?xml version="1.0" encoding="ISO-8859-1"?> <game> <gameid>16</gameid> <turn>24262</turn> <notturn>15010</notturn> <dateline>1275511672</dateline> <hcount>6</hcount> <ccount>4</ccount> <turn_html><![CDATA[ --Snipped-- ]]></turn_html> <board_html><![CDATA[ --Snipped-- ]]></logs_html> <cactivate>60580</cactivate> <cactivate>65401</cactivate> <cactivate>78720</cactivate> <cactivate>80275</cactivate> <sactivate>0</sactivate> <sactivate>1</sactivate> <sactivate>2</sactivate> <sactivate>3</sactivate> <sactivate>4</sactivate> <sactivate>5</sactivate> <sactivate>6</sactivate> <sactivate>7</sactivate> <sactivate>8</sactivate> </game> Any help would be appreciated, thanks. Hi everyone.. I am using the script below to run a rating plugin... it works on all browsers except ie6 and 7.. any help would be greatly appreciated.. thanks in advance.. $.fn.rater = function(options) { var opts = $.extend({}, $.fn.rater.defaults, options); return this.each(function() { var $this = $(this); var $on = $this.find('.ui-rater-starsOn'); var $off = $this.find('.ui-rater-starsOff'); opts.size = $on.height(); if (opts.rating == undefined) opts.rating = $on.width() / opts.size; if (opts.id == undefined) opts.id = $this.attr('id'); $off.mousemove(function(e) { var left = e.clientX - $off.offset().left; var width = $off.width() - ($off.width() - left); width = Math.ceil(width / (opts.size / opts.step)) * opts.size / opts.step; $on.width(width); }).hover(function(e) { $on.addClass('ui-rater-starsHover'); }, function(e) { $on.removeClass('ui-rater-starsHover'); $on.width(opts.rating * opts.size); }).click(function(e) { var r = Math.round($on.width() / $off.width() * (opts.units * opts.step)) / opts.step; $off.unbind('click').unbind('mousemove').unbind('mouseenter').unbind('mouseleave'); $off.css('cursor', 'default'); $on.css('cursor', 'default'); $.fn.rater.rate($this, opts, r); }).css('cursor', 'pointer'); $on.css('cursor', 'pointer'); }); }; $.fn.rater.defaults = { postHref: location.href, guid: 0, units: 5, step: 1, }; $.fn.rater.rate = function($this, opts, rating) { var $on = $this.find('.ui-rater-starsOn'); var $off = $this.find('.ui-rater-starsOff'); $off.fadeTo(600, 0.4, function() { $.ajax({ url: opts.postHref, type: "POST", data: 'id=' + opts.id + '&guid=' + opts.guid + '&rating=' + rating, complete: function(req) { if (req.status == 200) { //success opts.rating = parseFloat(req.responseText); $off.fadeTo(600, 0.1, function() { $on.removeClass('ui-rater-starsHover').width(opts.rating * opts.size); var $count = $this.find('.ui-rater-rateCount'); $count.text(parseInt($count.text()) + 1); $this.find('.ui-rater-rating').text(opts.rating.toFixed(1)); $off.fadeTo(600, 1); $this.attr('title', 'Your rating: ' + rating.toFixed(1)); }); } else { //failure alert(req.responseText); $on.removeClass('ui-rater-starsHover').width(opts.rating * opts.size); $this.rater(opts); $off.fadeTo(2200, 1); } } }); }); }; -Carlos Hey, I'm try to create a web page which slides down sub catagories when menus are clicked on. However, when the divs slide down there seems to be an unwanted 'snap' in the movement. Does anyone know how to solve this? Also, when the menu headings are clicked on the second time (which should slide the menu back up), the menu title disapears?? Heres the coding I've used and the link to the site: http://www.pumphouseapps.co.uk/graph...ents_page.html <script type="text/javascript"> $(document).ready(function() { var SectionName; var SectionNameLengh; var sectionChildName; var childName; $(".Subsection01").toggle( function () { SectionName=this.id; $("#"+SectionName).children().each( function() { var child = $(this); if (!(child.hasClass('MainSectionTitle'))) { child.slideDown(); } } ); /*$(".Subsection02").slideDown();*/ /*SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).show();*/ }, function () { SectionName=this.id; $("#"+SectionName).children().each( function() { var child = $(this); if (!(child.hasClass('MainSectionTitle'))) { child.slideUp(); } } ); /*$(".Subsection02").slideDown();*/ /* SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).hide();*/ } ); $(".Subsection03").toggle( function () { SectionName=this.id; $("#"+SectionName).children().slideDown(); /* SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).show();*/ }, function () { SectionName=this.id; $("#"+SectionName).slideUp(); /*SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).hide();*/ } ); }); </script> |