JavaScript - Check My Script And Fix Plz
plz check bold part of function is not working. what is wrong with it.?
Code: function onesizecheck(chk_id,siz) { alert(chk_id); if(document.getElementById('siz_check').value=='') { document.getElementById('siz_check').value=siz; }//end if if(document.getElementById('siz_check').value==siz) { document.getElementById('siz_check').value=siz; } else { alert('Multi size are not allowed.'); for(var i = 0; i < document.delet['checkbox[]'].length; i++){ var cb = document.getElementById('checkbox'); alert(cb[i].value); } } }//end function Similar TutorialsHi all I have this rollover script (original done by Old Pedant) which I have modified making it 5 sets of 2 images. Althogh it seems to work I have a feeling it's not the best way of doing it hahahaha It seems clumsy to me (and i'm no coder hahaaha) Could it be made more concise. (or just made correct) Would really appreciate any help or positive comments. Code: <script type="text/javascript"> function linkOver(link) { var image = link.getElementsByTagName("IMG")[0]; image.src = image.src.replace("Off_1.png","On_1.png"); image.src = image.src.replace("Off_2.png","On_2.png"); image.src = image.src.replace("Off_3.png","On_3.png"); image.src = image.src.replace("Off_4.png","On_4.png"); image.src = image.src.replace("Off_5.png","On_5.png"); } function linkOut(link) { var image = link.getElementsByTagName("IMG")[0]; image.src = image.src.replace("On_1.png","Off_1.png"); image.src = image.src.replace("On_2.png","Off_2.png"); image.src = image.src.replace("On_3.png","Off_3.png"); image.src = image.src.replace("On_4.png","Off_4.png"); image.src = image.src.replace("On_5.png","Off_5.png"); } </script> </head> I have 5 of these: Code: <body> <div id="megaanchor" onmouseover="linkOver(this), callSecondFunction('soldier',50,40,200);" onmouseout="linkOut(this);" ><img src="images/image_Off.png" alt="" border="0" /> </body> Hi all, I am writing an administration panel for a web site. I want to check if the client's browser javascript enabled and if it is not enabled, a warning DIV comes telling the client to enable javascript and disable the actual page (make the actual page non-usable). Is there a way to do that? Thanks in advance telmessos Hello all, Sorry for not reading the "posting guidelines" earlier. I understand that you guys are not reading/loading complete codes, my bad. Let me try again. This is a code for checking numbers A1 -> B1, when there is a match, the code will be green, otherwise black. Can somebody explain to me how I can extend this script, that more then one array is checked?? Code: <script type = "text/javascript"> var a1 = ["2","5", "11","16","23","45", "46"]; var b1 = ["2","3","8","12","23", "37", "41", "45", "48"] for (var i = 0; i< a1.length; i++) { for (var j = 0; j< b1.length; j++) { if (a1[i] == b1[j]) { a1[i]= "g"+ a1[i]; } } } for (var i = 0; i< a1.length; i++) { if (a1[i].substr(0,1) == "g") { a1[i] = a1[i].substr(1,20); document.write("<font color = 'green'>", a1[i] + "    "); } else { document.write("<font color = 'black'>", a1[i] + "    "); } } document.write("<br><br>"); for (var j = 0; j< b1.length; j++) { document.write("<font color = 'black'>", b1[j] + "    "); } </script> Thanks a ton in advance On this webpage http://www.corkdiscos.com/testimonials.html i have a like button. when a user clicks like a comment box appears. when i unlike the button the comment box disappears this is ok but when a user has already liked the facebook page and comes to my webpage the comment box does not show. so im looking for a piece of javascript to check if a user has like the button on my page and if so to show the comment box. please check my source code of the website http://www.corkdiscos.com/testimonials.html to see what i have so far. any help would be greatly appreciated hello there this is in vb script. but i dont where to post it. can any one hlep me out plzz I need to check if the date entered by user is within 5th date from current date. I am trying to do it this way entered date has month and date value Code: sResvDate = 01/24 Set sMaxDays to getdate(5) but get date will give year too. and how do i compare if it less than 5th day or not. Hi guys. I'm working a bunch of pre existing code on a CMS. Just after a quick fix. Doing a show/hide thing on a particular div somewhere on the page depending if a checkbox is ticked or not. Currently there is 3 checkboxes that are dynamically added through the CMS. Here's simplified version of the form: Code: <form id="simplesearch" name="simplesearch"> <input type="checkbox" onclick='showhidefield(this.value)' name="meta_data_array_search_criteria[custom_profile_type][]" value="5" class="input-checkboxes" /> <input type="checkbox" onclick='showhidefield(this.value)' name="meta_data_array_search_criteria[custom_profile_type][]" value="4" class="input-checkboxes" /> </form> And here's the javascript I was playing with. Code: function showhidefield(id) { if(document.simplesearch.meta_data_array_search_criteria[custom_profile_type][''].checked) { document.getElementById("profile_fields_wrapper_" + id).style.visibility = "visible"; } else { document.getElementById("profile_fields_wrapper_" + id).style.visibility = "hidden"; } } Problem I'm having is how do i do a check to see if those checkboxes are checked in the javascript with those name arrays? How do i separate them? 'm guessing I have to loop through them or something?Hopefully that make senses - it's late here and I'm losing the plot Any pointers would be gratefully welcomed Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. this code is supposed to ask the users name and say how many letters in it get 2 random numbers ask user to add them if right say Well Done! if wrong say Sorry, you are wrong. when i run this nothing comes up whats wrong? thanx Code: <script> var firstName = ""; var numLetters = 0; firstName = prompt("Hi, what's your first name?", ""); numLetters = firstName.length; alert ("Did you know there are " + numLetters + " letters in your name?"); var num1 = Math.floor(Math.random()*9) + 1; var num2 = Math.floor(Math.random()*9) + 1; var answer; var useranswer; answer = num1+num2; useranswer = promt("What is" + num1 + "+" + num2 + "?"); If (answer = useranswer) { alert("Well done!"); } else { alert("Sorry, you are wrong."); } </script> I have a text input box that resets to blank when the user enters an alpha character, it also checks for the number 0 as it has to be greater than 0 too... when I submit the form it is blank the variable changes to blank (as I use parseInt to convert it to an integer at a later stage) What can I do to check and see if it is NaN value? (I've tried isNaN() and it did not do what I wanted it to) Hello, today I am trying to allow a user to easily uncheck/check all checkboxes in a form by checking or unchecking a checkbox. The checkboxes would be in a form like so: Code: <form action="" method="post"> <input type="checkbox" name="checked[]" value="1"> <input type="checkbox" name="checked[]" value="2"> <input type="checkbox" name="checked[]" value="3"> <input type="checkbox" name="checked[]" value="4"> </form> I use an event handler to call a function: Code: <input type="checkbox" name="checkall" onchange="checkall('checked[]', this.checked)"> And here is the function: Code: function checkall(box_name, current_state) { all = document.getElementsByName(box_name); action = (current_state == "checked") ? "false" : "true"; for (i = 0; i < all.length; i++) { all[i].checked=action; } } The event handler should pass the name of the checkboxes and whether the "check all" checkbox is currently checked or not to the checkall() function. Nothing happens when I check/uncheck the "check all" function. Help? I am trying to add values from 6 text boxes and display its sum automatically in 7th text box. This is not working. Please help. function calculate_a() { var a = document.getElementById('Para_A_A1_score').value ; var b = document.getElementById('Para_A_A2_score').value ; var c = document.getElementById('Para_A_A3_score').value ; var d = document.getElementById('Para_A_A4_score').value ; var e = document.getElementById('Para_A_A5_score').value ; var f = document.getElementById('Para_A_A6_score').value ; var g = (a+b+c+d+e+f) ; document.audit_billing_IE.product_name4.value = g ; } Quote: Below is the html form code that should automatically display the total value without clicking on any submit or send button <tr> <td> Parameter A </td> <td colspan='3'> <input type="text" name="product_name4" id="product_name4" onchange="calculate_a(this);" /> </td> </tr> This is perhaps a somewhat trivial point but it's bugged me a couple of times recently and I wondered if anyone out there had any thoughts on the matter. Essentially I have an action that can happen many times but I want to record whether it has happened at least once. I know we are talking about a trivial amount of processing and code here but is there any real difference between the following two methods: Code: myCheck: false, myRepeatedlyCalledFunction: function() { this.myCheck = true; // do some stuff } vs Code: myCheck: false, myRepeatedlyCalledFunction: function() { if(this.myCheck === false) { this.myCheck = true; } // do some stuff } thoughts? I was wondering if there was a simple way of notifying a user who has entered an incorrect postcode? I have found numerous answers to this problem but i am sure there is a simpler way to do it as ones i have found have rows and rows of code. Help is much appreciated I am trying to get a link that when clicked it will check all the checkboxes in my form. My problem is that my values are stored in an array: <INPUT TYPE=\"checkbox\" name=\"emailArray[]\" value=\"$email\"> print"<br><a href=\"#\" onClick=\"checkAll()\">check all</a><br>"; Here is my javascript function : function checkAll(){ alert('hi'); var df = document.selectEmailForm.elements; for (var i = 0; i < df.length; i++) { if (df[i].name == "emailArray[]" ) { document.selectEmailForm.emailArray[i].checked=true; } } } Any ideas? Any help is greatly appreciated. Thanks for your time! I have NO knowledge of Javascript at all but borrowed and attempted to adapt one I found. It is a Firefox bookmarklet designed to highlight in different colours both certain words or the ending "ing" on a word in a text document that has been saved as html. Basically it is a device for helping novel writers rid their manuscripts of redundant words and overuse of the 'ing" words. In works in part but doesn't pick up all "ing" endings. For someone who know what their doing I imagine it would take more than a few minutes to read and correct. Many thanks to anyone who can help. Here is the Javscript: javascript:var%20verbsRE=/(\b)(about|actually|almost|already|appear|approximately|basically|close to|even|eventually|exactly|finally|here|just|kind of|nearly|now|practically|really|seem|simply|somehow|somewhat|sort of|suddenly|then|there|truly|utterly|while|as|appear|felt|gaped|gawked|gazed|glanced|hear|heard|knew |looked|noticed|observed|peered|peeped|regarded|saw|scanned|see|seeing|seemed|smelled|stared|studied |surveyed|tasted|viewed|watched)(\b)/gi;var%20ingRE=/(\w)(ing)(\b)/gim;function%20HL(node){if(node.hasChildNodes){var%20hi_cn;for(hi_cn=0;hi_cn<node.childNodes.length; hi_cn++){HL(node.childNodes[hi_cn]);}}if(node.nodeType==3){var%20tempNodeVal=node.nodeValue;if(verbsRE.test(tempNodeVal)){tempNodeVal= tempNodeVal.replace(verbsRE,"$1<span%20style='background-color:yellow;color:black;border:1px%20solid%20black;'>$2</span>$3");tempNodeVal=tempNodeVal.replace(ingRE,"$1<span%20style='background-color:#0ff;color:black;border:1px%20solid%20black;'>$2</span>$3");newNode=document.createElement('span');newNode.innerHTML=tempNodeVal;pn=node.parentNode;pn .replaceChild(newNode,node);}}}HL(window.document.getElementsByTagName('body')[0]); Hi, I am not familiar with javascript, I am using a check box validation tool that I copied from this site: http://mediazeal.com/checkbox-validator.htm This is my webpage: http://rbhlc.weebly.com/discover-hea...n-jyutsu.html# Right now when you click the buy now button (when the checkbox is checked) i does not go to the hyperlink. How can I get the button to go to my link when the checkbox is validated? Here is my code: (the authorize.net account it a Test Account.. so it won't link to anything sensitive) <form name="form" method="post" action="#" onSubmit="return checkme();"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="2" align="center"><input type="checkbox" name="agree" value="agree_terms"> I agree to the terms</td> </tr> <tr> <td colspan="2" align="center"> <form name="PrePage" method = "post" action = "https://scotest.authorize.net/payment/CatalogPayment.aspx"> <input type = "hidden" name = "LinkId" value ="3569f626-b8a8-4974-8ceb-35ca08a63087" /> <input type = "image" src ="//testcontent.authorize.net/images/buy-now-gold.gif" /> </form> </td> </tr> Thank you for your support. |