JavaScript - Disable Div On Load
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> Similar Tutorialshow can i make a button disable when the page is loaded first time and then make it enable on the click of other button in javascript.
Hi all Is there a way to get the image(s) to load into the table after the page has loaded instead of the way I have it now? I have 4 tabs, but I would like the imgs in tabs 2,3,4 to load after page load. Example of how the tabs look. Code: <div class="tabbertab"> <h2>Australia_____</h2> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFCC"> <caption class="highlight_Red">澳洲 Australia </caption> <tr> <td><a href="pages/promotion.html#aus_ACE" rel="nofollow" target="_blank"><img src="pages/images/Pics/AUS/ace.jpg" alt="ACE / ATTC" width="110" height="69" border="0" align="left" class="ozimg_L"/> ...a few more images etc the other tabs look the same. LT This script displays a link to a registration/login form that loads in a light box for Joomla. I've been goin nuts trying to figure out how to get this to load on page load with a delay. Anyone know how to get this done? PHP Code: <?php JHTML::_('behavior.mootools'); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'media/system/css/modal.css'); $document->addScript(JURI::base() . 'media/system/js/modal.js'); $document->addScriptDeclaration("window.addEvent('domready', function() {SqueezeBox.initialize({});});"); $user = & JFactory::getUser(); $uri = JFactory::getURI(); $url = $uri->toString(); $return = base64_encode($url); ?> <div id="lbframeid" style="position:absolute;top:1px;left:1px;height:0px;width:0px;overflow:hidden"> <a href="http://www.wowjoomla.com/"><h1>Joomla Login LightBox powered by WowJoomla.com</h1> </a> </div> <?php if ($user->get('guest')) :?> <a href="<?php echo JRoute::_('index.php?option=com_loginbox')?>" onclick="SqueezeBox.fromElement(this); return false;" rel="{handler: 'iframe', size: {x: 660, y: 500}}"><?php echo JText::_('SIGNUP_LOGIN')?></a> <?php else: ?> <?php echo JText::sprintf( 'HINAME', $user->get('name') ); ?> <br> <a href="javascript:void(0);" onclick="LB_onLogout(); return false;"><?php echo JText::_('LOGOUT')?></a> <?php endif; ?> <script type="text/javascript"> function LB_onLogout() { var form = new Element('form'); form.setProperty('method', 'POST'); form.setProperty('target', '_self'); form.setProperty('action', 'index.php'); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'option'); input.setProperty('value', 'com_user'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'task'); input.setProperty('value', 'logout'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'return'); input.setProperty('value', '<?php echo $return; ?>'); form.appendChild(input); $E('body').appendChild(form); form.submit(); } </script> Hi guys, I am trying to insert the following call into my page; Code: <script type="text/javascript" defer="true"> $('#query').autocomplete({ serviceUrl:'service/autocomplete.ashx', minChars:1, delimiter: /(,|;)\s*/, // regex or character maxHeight:400, width:250, deferRequestBy: 0, //miliseconds params: { country:'Yes' }, //aditional parameters // local autosugest options: lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values }); </script> It works fine in all browsers except ie(6,7,8) Code: Internet Explorer can not open website. Operation Aborted. I understand it is caused by the jquery autocomplete function loading before the page / DOM has fully loaded. I tried adding Defer="true" to the script however this doesn't seem to work. Could someone please tell me what i must add to the script so that it loads after the dom has fully loaded? Thanks guys George 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. 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 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.
Hi 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 Hi, how to disable the restore down button in internet explorer through java script. Regards, Basha. 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]); } 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 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 Hi.. I have 2 groups of radio buttons.. I can manage to make one set be disabled via a selection.. but i can only get this right with the VALUE... Is it possible to use the radio id to do the same?? Just use the link below for they jquery <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script src="jquery.min.js"></script> </head> <body> <br /> <br /> <div> 1 - <input type="radio" id="1" value="11" /> </div> <div> 2 - <input type="radio" id="2" value="22"/> </div> <div> 3 - <input type="radio" id="3" value="33"/> </div> <br /> <br /> <div> 1 - <input type="radio" id="1" value="11" /> </div> <div> 2 - <input type="radio" id="2" value="22" /> </div> <div> 3 - <input type="radio" id="3" value="33" /> </div> <script> $("input:radio").click(function() { var val = $(this).val(); $(this).siblings("input:radio").attr("disabled","disabled"); $("input:radio[value='" + val + "']").not(this).attr("disabled","disabled"); }); </script> </body> </html> 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. 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> Greetings! I'm new in JS. I have codes below that disable the other checkbox when the other is checked, now I want to add check all button. Is it possible? how can I do it? any help would be great! Code: <script language = "Javascript" type="text/javascript" > function checkbox_disabled(tocheck,todisable,todisable2) { var x = document.getElementById(tocheck); if(x.checked){ document.getElementById(todisable).disabled=true; document.getElementById(todisable2).disabled=true; document.getElementById(todisable2).checked = false; }else{ document.getElementById(todisable).disabled=false; document.getElementById(todisable2).disabled=false; document.getElementById(todisable2).checked = true; } } </script> Hello Friends, i have a small problem and need your help. I have a form with 4 radio buttons, the scenario is, when a user click on a radio button a hidden content will be displayed and the other three radio buttons will be disabled so that at one time a user can only click and view single radio button and the hidden content. Here is my code to show hide the hidden content but i need when the user select one radio button the other radio buttons should disable. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>test</title> <style type="text/css" media="screen"> .hide{ display:none; } </style> </head> <body> <div id="tabs"> <div id="nav"> <p>Show Div 1:<input type="radio" name="tab" value="value1" class="div1" /></p> <p>Show Div 2:<input type="radio" name="tab" value="value2" class="div2" /></p> <p>Show Div 3:<input type="radio" name="tab" value="value3" class="div3" /></p> <p>Show Div 4:<input type="radio" name="tab" value="value4" class="div4" /></p> </div> <div id="div1" class="tab"> <p>this is div 1</p> </div> <div id="div2" class="tab"> <p>this is div 2</p> </div> <div id="div3" class="tab"> <p>this is div 3</p> </div> <div id="div4" class="tab"> <p>this is div 4</p> </div> </div> <script type="text/javascript" charset="utf-8"> (function(){ var tabs =document.getElementById('tabs'); var nav = tabs.getElementsByTagName('input'); /* * Hide all tabs */ function hideTabs(){ var tab = tabs.getElementsByTagName('div'); for(var i=0;i<=nav.length;i++){ if(tab[i].className == 'tab'){ tab[i].className = tab[i].className + ' hide'; } } } /* * Show the clicked tab */ function showTab(tab){ document.getElementById(tab).className = 'tab' } hideTabs(); /* hide tabs on load */ /* * Add click events */ for(var i=0;i<nav.length;i++){ nav[i].onclick = function(){ hideTabs(); showTab(this.className); } } })(); </script> </body> </html> Thank you for your help in advance. 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 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? I'm new at JavaScript and not sure if what I want to do is possible. This is part of the code from a larger check-in form. This code adds a new row as needed and should also enable the text fields only after the check box is selected. It is not working as expected and I am missing what the problem may be or if this is even possible. Any help would be appreciated. [CODE] <!DOCTYPE html> <html lang="en"> <title></title> <script type="text/javascript"><!-- function addRow() { tabBody=document.getElementById("data"); row=document.createElement("TR"); cell1 = document.createElement("TD"); checknode1 = document.createTextNode("\u00a0\u00a0\u00a0\u00a0"); checknode2 = document.createElement("input"); checknode2.name="guest[]"; checknode2.id='guest[]'; checknode2.type="checkbox"; checknode2.setAttribute('onclick', 'disablefields();'); cell2 = document.createElement("TD"); textnode1 = document.createTextNode("\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0"); textnode2=document.createElement("input"); textnode2.type="text"; textnode2.name='guestc[]'; textnode2.id='guestc[]'; textnode2.setAttribute('disabled',''); textnode2.size="7"; textnode2.maxlength="9"; textnode2.setAttribute('onkeyup', 'this.value = this.value.toUpperCase();'); cell3 = document.createElement("TD"); textnode3=document.createElement("input"); textnode3.type="text"; textnode3.name="guestn[]"; textnode3.id='guestn[]'; textnode3.setAttribute('disabled',''); textnode3.size="20"; textnode3.maxlength="30"; cell4 = document.createElement("TD"); checknode3 = document.createTextNode("\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0"); checknode4 = document.createElement("input"); checknode4.name="food[]"; checknode4.id='food[]'; checknode4.type="checkbox"; checknode4.value="breakfast"; cell1.appendChild(checknode1); cell1.appendChild(checknode2); row.appendChild(cell1); tabBody.appendChild(row); cell2.appendChild(textnode1); cell2.appendChild(textnode2); row.appendChild(cell2); tabBody.appendChild(row); cell3.appendChild(textnode3); row.appendChild(cell3); tabBody.appendChild(row); cell4.appendChild(checknode3); cell4.appendChild(checknode4); row.appendChild(cell4); tabBody.appendChild(row); } --> </script> <SCRIPT LANGUAGE="JavaScript"> <!-- function disablefields(){ if (document.getElementById('guest[]').checked == 0){ document.getElementById('guestc[]').disabled='disabled'; document.getElementById('guestc[]').value=''; document.getElementById('guestn[]').disabled='disabled'; document.getElementById('guestn[]').value=''; document.getElementById('food[]').disabled='disabled'; document.getElementById('food[]').value=''; }else{ document.getElementById('guestc[]').disabled=''; document.getElementById('guestc[]').value='Call Sign'; document.getElementById('guestn[]').disabled=''; document.getElementById('guestn[]').value='Enter Name'; document.getElementById('food[]').disabled=''; document.getElementById('food[]').value='breakfast'; } } --> </SCRIPT> </head> <body> <form name="checkin" method="post"> <table> <tbody id="data"> <tr><td> <input type="checkbox" name="guest[]" id="guest" onclick="disablefields()"></td> <td> <input type="text" disabled name="guestc[]" id="guestc[]" size="7" maxlength="9" value="" onkeyup="this.value = this.value.toUpperCase();" /></td> <td><input type="TEXT" name="guestn[]" disabled id="guestn[]" size="20" maxlength="30" value=""></td> <td> <input type="checkbox" name="food[]" disabled id="food[]" value="breakfast"></td></tr> </tbody> </table> <table border="0" width="100%"> <tr> <td><input type="button" value="Add new check-in" onclick="addRow();" /></td> </tr> </table> </form> </body> </html> [CODE] |