Jump to content

nogray

Members
  • Posts

    930
  • Joined

  • Last visited

Everything posted by nogray

  1. You are going the wrong way about setting this. First, there is no "options" in the button element, you would add the onclick directly to it. What you would need to do is set the onclick to a function that will check the value and redirect based on it. e.g. First remove the change event from the select menu. <input type="button" name="btnAddToCart" value="Add To Cart >" onClick="setSize();" class="addToCartButton"> function setSize() { var sizeVal = document.getElementById('pd_Size').options[pd_Size.selectedIndex].value; var hrefVal = '<?php echo $cart_url; ?>'; if (sizeVal != '') { hrefVal = hrefVal + '&s=' + sizeVal; } location.href = hrefVal; }
  2. I ment post the final script (not the php) here. e.g. view source of the page and copy the javascript code in here.
  3. If you post the output of your form it will be easier to debug, but does your Address1 or Account_Name has an single quotes, line breaks or other characters that might break out your syntax?
  4. You can use ajax, iframes, or if you want it to look like a window, jquery dialog http://jqueryui.com/dialog/
  5. You need to add the functional parameter in your extend functions, e.g. var options = $.extend({ startTab : 1 }, options)
  6. You need to make the request a global variable. e.g. // global variable var request; function onSearch(value){ if(request != null) request.abort(); // no "var" infront of request request = $.ajax({
  7. You can just do alert(document.getElementById('thirdDD1').value) ; assuming thirdDD1 is an input, select or textarea.
  8. Let's say you have this html code <a href="#" class="contactlink" id="my_link_id_1">, you can use jquery to extract the id as the following $('.contactlink').click(function(){ var id = this.id; id = id.split('_'); id = id[id.length - 1]; alert(id); // You can use $("#contact_id_"+id).slideToggle('fast'); here });    
  9. Since your elements do not share a parent and they are not directly related, you would need to add either an id or a reference to link both of the elements (e.g. give the link an id "contactlink_id_1" and the div "contact_id_1"). Otherwise, you would have to loop through the entire document and check if the contact element is after the element that fired the event (which is not optimal)..
  10. If you want your script to work like a native app without any loading, you would need to load the data into a javascript variable (e.g. array of arrays) and let javascript create the table with the page data on demand. You can store thousands of rows as data in an array without any performance lag put do not try to create the table for all of them as the same time. Just create the rows for the current page. You can also search about sorting etc in javascript.
  11. The jquery ready runs before the window.onload event since it doesn't have to wait for images etc... You can just take your the function from the onload event and put it in the top of your jquery ready (before the flexslider).
  12. Without seeing the actual text, it's hard to debug. But it seems you are losing 10 characters when you slice your strings (slice to 90 and start from 100). A much easier solution would be to use CSS text-overflow.
  13. You can simply ready the input value for the total in your other function, e.g. function my_other_function(){ var materialtotal = document.getElementById( 'materialtotal' ).value }
  14. Most likely you tried to call the getElementById before the page loads or before the element is on the page.
  15. You can add an onload function that checks the checkbox status e.g. if (document.getElementById('my_checkbox_id').checked) { dosomething(); }
  16. Than it's most likely something else in your page that causing the error (e.g. another javascript error) because I tested your code and it seems to work fine http://jsfiddle.net/2uYE8/
  17. Another thing to consider is the (context: thatmsg) is thatmsg globally defined?
  18. Probably because you are escaping the quotes in open command and the dialog id in your function \'msgdialog\' (\'open\');
  19. Since you are querying the elements using class name, you can give all the similar elements similar class and use this in the function. this will be the element that fired the event. You would need to add the events once. If you want to modify other related elements, you can get the parent node of this and use it as the context for your selection, e.g. $('.edit', this.parentNode).show(); Just make sure each row has one parent element, e.g. <div id="parent_row_123"><div ,,,></div><div ...</div></div><!-- closing parent -->
  20. Try changing $(this).css('position', 'relative') to $(this).css('position', 'absolute') and add a spacer element for the original size underneath to hold it's space.
  21. Since you already using jquery, you can use a sortable widget, http://api.jqueryui.com/sortable/ and serialize the list on change.
  22. You have a "die()" before your sql insert. Also, if you are writing the sql query directly, use 'mysql_real_escape_string' on all the variables.
  23. If type is not numerical value, you need to enclose it quotes in your onclick event, eg onclick="remove(\''+type+'\','+desId+')"
  24. When you include parenthesis you are telling the browser to execute the function and assign the return value to the variable. And when you omit the parenthesis, you are telling the browser to assign the function itself to a variable. For example function returnA(){ return 'A'; } var my_A = returnA(); // my_A will be a string 'A'; var my_A_func = returnA; // my_A_func will be a function that returns 'A' // using the new variables alert(my_A); // alerts 'A'; alert(my_A_func) // alerts the function code alert( my_A_func() ) // alerts 'A'
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.