JavaScript - Trying To Disable A Picture With Js
I'm trying to disable my record navigation pictures when they get to the end of a calendar (events are posted on days, and navigation goes to the next or previous one).
Code: <a onclick="javascript:previousEvent();"> <input type="image" name="previous" src="images/SiteCollectionImages/MiniEvents/btn_Previous.gif" alt="Previous Event" title="Previous Event"/></a> <a onclick="javascript:nextEvent();"> <input type="image" name="next" src="images/SiteCollectionImages/MiniEvents/btn_Next.gif" alt="Next Event" title="Next Event"/></a> This is where I have to disable the pictures. Above in my JS I would like to have a handler that could disable them when they are at the end of the index, or at the beginning. Thanks! edit: I do have the logic already, just not sure how to disable the images. Code: function nextEvent(i) { if (index == maxIndex || index >= maxIndex) { //disable next button tempObj = document.getElementsByName("next"); tempObj.visible = false; } else { index = index + 1; eventSelected(rawDates[index]); } Similar TutorialsHi all, I have a form with a number of checkboxes. The 1st one is "Select All". When this checkbox is ticked I would like to disable all others. When the "Select All" checkbox is unticked, all checkboxes should be enabled. Can anyone tell me how to do this? is JQuery the preferred method these days? Thanks in advance Is there a way to disable a SINGLE script on the page, something that a user can click and it disables only the script choosen? Thanks, Latchy Hi, how to disable the restore down button in internet explorer through java script. Regards, Basha. Hello, I have been looking for a good walk-through online, but can't seem to find an exact resolution to what I am trying to do. Can someone please supply some example code for not displaying everything that is inside a <div>. Basically I do not want social media content to be displayed on secure pages, but want them on every other page. This is what I have: Code: <div id="share"> <ul> <li> <div class="addthis_toolbox addthis_default_style "> <a href="http://www.addthis.com/bookmark.php?v=250&username=###### class="addthis_button_compact">Share</a> <span class="addthis_separator">|</span> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> </div> </li> <script> var addthis_config = {"data_track_clickback":true}; if (document.location.protocol !== 'https:') { $jq.getScript('http://s7.addthis.com/js/250/addthis_widget.js?username=######', function() { }); } </script> </ul> </div> Is it possible to disable all scripts within a certain div? Like if I was displaying something in <div id="member"> and a member posts a script within that div, I would like it to not work.
I'm probably not allowed to request something like this, but since this is a small amount of code I think I should do it anyways :P Okey, so I have two listboxes and I want a tickbox to enable one listbox and disable one listbox as you tick a checkbox. I want one listbox disabled by default and the other enabled and then vice-verca the disable when you tick the box. If someone could supply me with that code I would be really greatful, butyou don't need to bother with the HTML, I should figure it out from the JS. Thanks in advance <3 I have a website that contains a large div inside a smaller div, only to be scrolled via javascript. The problem is when you mouseover the smaller (container) div and you scroll the mousewheel down, everything scrolls down. I've been searching for a while and haven't got any answers. www.designbyryanboog.com/spa (site only works in IE8, Chrome, Safari, Opera, Firefox<slowly>) Thanks in advance Hello, Thanks for reading. This is my first post, I hope it's not too stupid. Should I disable the right click option or not? I have a gallery site, I don't want people to be able to copy the images with the default right click over an image. From a professional looking site point of view I suppose I would be messing with the functionality a bit too much, OR is it OK in this instance to disable the click. I know how to write the code to disable the click, but what I was thinking was maybe it would be better to leave the right click but change the menu options? I'm not sure how to change the menu options, any suggestions would be appreciated Here is a link to the site. http://www.thephotographbox.com/?ID=3 (It's still in the early stages on development) Thanks for any advice. Derek. How can you have a smaller version of a picture and when you click on it a bigger version pops up? Is this easily possible with JS? hi below is my script, what i add in a link<a href=xxx></a> for disable this script for that link regards Quote: <SCRIPT LANGUAGE="Javascript"> function PopShow3() { CookieTest=navigator.cookieEnabled; if(CookieTest) { ClickUndercookie = GetCookie('clickunder'); if (ClickUndercookie == null) { var ExpDate = new Date (); ExpDate.setTime(ExpDate.getTime() + (0 * 0 * 0 * 0)); SetCookie('clickunder','1',ExpDate, "/"); window.open("http://www.google.com"); window.focus(); } } } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } document.onmouseup=PopShow3; </SCRIPT> Hello all, i am new to forum. I am working with a javascript for that I want to have the table disable when the page loads and enable only if the user checks the checkbox. Can anyone help me with this?-- here is my code <script type="text/javascript"> function hideshow(){ var cells=document.getElementById('tab').getElementsByTagName('td'), i=0, c; var chb=document.getElementById('chboxes').getElementsByTagName('input'); while(c=cells[i++]){ c.style.display=chb[c.cellIndex].checked?'':'none'; } } function setEvent(){ var chb=document.getElementById('chboxes').getElementsByTagName('input'), i=0, c; while(c=chb[i++]){ if(c.type=='checkbox'){c.onclick=function(){hideshow()}} } } onload=setEvent; Thanks in advance been trying to get the selection in the first field to change the next field only if the first selection is 'other' I do not get any errors and my code could be completely wrong. Can anyone see why the selection will not change the next fields status. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> <!-- function check_select(form, selection, other) { var theform = document.getElementById(form); var theselection = theform.selection.value; if ((theselection == "other")) { theselection.disabled = false; } else { theselection.disabled = true; } } --> </script> </head> <body> <form id="form1" name="form1" method="post" action=""> <select name="selection" onChange="check_select('form1', 'selection', 'other')"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="other">other</option> </select> <br> <br> <input id="other" type="text" name="other" disabled> </form> </body> </html> hi again i have form with name age payment mode ( combo boxe include payment mode 1,payment mode 2 , payment mode 3) when i select a payment mode-01 enabbleling 5 combo boxes if slect payment mode 2 dissabling that combo boxes... how do i do this thing plzz give me sample code...................... Is there a javascript code so that you can disable a textarea but parts of the page can still add to the textarea if your peter i mean about the other javascripts you told me. Sorry if this is confusing just ask me and i will rewrite it
Hi, Well I wanted to ask that how to disable the function of hide button in meebo bar, its that small arrow like button on the right side, which is when clicked hides meebo bar, I want to disable it, so that even if it is clicked it doesn't hide the bar. To see the bar you can visit http://www.meebo.com/websites actually, the subject pretty much is the question, but if you want more detail, here goes: the below function: Code: function centerAndZoom(line) { bounds = line.getBounds(); map.setCenter(bounds.getCenter(map), map.getBoundsZoomLevel(bounds)); } pans and zooms the map when the user selects a line, which is really useful about 95% of the time and kind of annoying 5% of the time. So I was thinking it would be good to give them the option of disabling that function for the 5%. the function gets called from a couple of different places in the code, so for neatness' sakes it would be nice to have something within the function above that checks for the checkbox state before executing. but some kind of if/else where the function gets called would be ok, too... I'm not really fussy. thanks in advance. Hi I have the following code...
Code: <!doctype html> <html> <head> <title>Loops</title> </head> <body> <form id = "frmOne"> <table border="1" > <p>Items Remaining: <a id="clicks">5</a></p> <tr> <th> Number One:</th> <th> Number Two:</th> </tr> <tr> <td> <Input Type="Text" Name="txtFirstNumber" Size="5" value=""> </td> <td> <Input Type="Text" Name="txtSecondNumber" Size="5" value=""> </td> </tr> <tr> <td colspan="2"> Totals: <textarea Name="totals" style="width: 400px; height: 300px;"></textarea></td> </tr> <tr> <td colspan="2"> <Input Type="Button" Name="b1" Value="Add Numbers" onClick = calculate()> </td> </tr> </table> </form> <script> var Totals = [ ]; var clicks = 5; function calculate() { var form = document.getElementById("frmOne"); var A = form.txtFirstNumber.value; var B = form.txtSecondNumber.value; Totals.push( A + " + " + B + " = " + (1*A+1*B) ); form.totals.value = Totals.join("\n"); form.txtFirstNumber.value = form.txtSecondNumber.value = ""; clicks -= 1; document.getElementById("clicks").innerHTML = clicks; } </script> </body> </html> I want to add in an if statement that checks to see if the number of items remaining is 0. If it is 0, I want it to say finished and the button be disabled / disappear. Can anyone help? TIA I want to disable modal box when the page it is attached to is being viewed on a mobile device. I have tried what I know and have crashed and burned. Help will be greatly appreciated. This is the code that I have use... Code: <script src="/o/4055/images/jquery.avgrund.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $(".hidden").avgrund({ width: 500, // max is 640px height: 340, // max is 350px showClose: true, // switch to 'true' for enabling close button showCloseText: 'close', // type your text for close button closeByEscape: false, // enables closing popup by 'Esc'.. closeByDocument: true, // ..and by clicking document itself enableStackAnimation: false, // another animation type onBlurContainer: 'div#container', // enables blur filter for specified block template: '<div style="margin: 0 auto; padding:0; width:500px; height:350px;">' + '<a href="https://afl.salsalabs.com/o/4055/p/salsa/donation/common/public/?donate_page_KEY=7606" style="border:none;" target="_blank"><img src="http://i1298.photobucket.com/albums/ag60/ProdSolutions/Lightbox_1_zpscead0a26.jpg" width="500px" height="350px" /></a>' + '</div>', onUnload: function() { var date = new Date(); date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); $.cookie("ARA_October_2014","true",{path:"/",expires:date}); } }); $(".hidden").trigger('click'); }); $("#submitContribution").attr('value', 'Donate Now'); $("label[for=cc_number]").after($('div#useCC fieldset#credit_card_information div.formRow div.helpText')); $("#credit_card_information > div:nth-child(6) > label:nth-child(1) > a:nth-child(1)").before($('#CVV2')); $('#personal_information > legend:nth-child(1)').each(function() { var text = $(this).text(); $(this).text(text.replace('Your Information', 'Your Billing Information')); }); $('div.formRow:nth-child(19) > label:nth-child(1)').each(function() { var text = $(this).text(); $(this).text(text.replace('Phone', 'Your Phone')); }); $('#credit_card_information legend').each(function() { var text = $(this).text(); $(this).text(text.replace('Credit Card Information', 'Payment Information')); }); $('#credit_card_information > div:nth-child(3) > label:nth-child(1)').each(function() { var text = $(this).text(); $(this).text(text.replace('Card Number', 'Credit Card Number')); }); $('#submit > p:nth-child(2)').each(function() { var text = $(this).text(); $(this).text(text.replace('Please click the submit button only once.', 'Please click this button only once.')); }); $('.readMore').click(function(){ $('.readMore').hide('slow'); $('.text2').show('slow'); }); </script> I am making a simple puzzle game on Android using Phonegap, that is HTML5, CSS3 and JavaScript. When a user fills an answer on a page, if the answer is correct, it will go to another page. However, once the user goes to the next page, he/she CANNOT return back to the previous page. I do not want the user to return back, else he/she will have to fill the answer again to go to the next page, so it's not good. Thank Disable Arrow Keys I am creating an online flash gaming site, Aaron's Game Zone: http://azzaboi.weebly.com Some of the games on it use the arrow keys, however IE also uses them to scroll the page. I am learning JavaScript and am trying to write some script to pervent the page scrolling up and down while playing a game. For example... Guardian Rock uses the arrow keys to slide around, at the same time the page scrolls. http://azzaboi.weebly.com/guardianrock.html Here is the script I've tried to write to pervent the scrolling: Code: <script type="text/javascript"> function KeyPressHappened(e){ if (!e) e=window.event; var key=e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; if(key == 37 || key == 38 || key == 39 || key == 40) { e.preventDefault(); return false; } return true; } document.onkeypress = KeyPressHappened; </script> There's a bug in it or it's not correct, no error message given, could anyone point out the mistake please? |