JavaScript - Js Disabled Handling
I've used js only for simple form validations thus far. I've been working on a coldfusion/ajax dynamic select list for a few days and just about have it functioning the way I want it.
My question is this. Whats the best way, if any, to handle users who turn js off. What I mean is, I have so far three separate queries for my three select lists, and are populated with ajax calls. Is there a way to get the same functionality with standard queries and page refreshes in case a visitor does have js disabled? Thanks for any tips and advice. Similar Tutorialshi, my problem is that .disabled only work in Firefox. How do i make it work in other browses? Below is the code i attached Code: if (output=="Available") document.register.submitBtn.disabled=false; else document.register.submitBtn.disabled=true; Hello, I'd like to use the following code on my website: <script type="text/javascript"> if(screen.width==1024) { document.write("<link rel='stylesheet' type='text/css' href='style1024.css' />"); } else { document.write("<link rel='stylesheet' type='text/css' href='style.css' />"); } </script> This inserts a different css file when the screen width is 1024, as you can see, BUT the problem is, that this way if someone has js disabled, he sees the page with no css, which would be very bad. So my question would be: Is there a way to set that my website checks if javascript is enabled or not and if not, it sets the normal css somehow? Thanks for your help. i have an assignment to solve in which i have given two checkboxes one is enabled and another one is disabled n m required that if we select enable checkbox the disabled checkbox may also be selected automatically can any one help out for its coding please Thanks Hi all! code without "return false": <a onclick="javascript: this.disabled = 1;" href="www.abc.com"> IE6/7 : both disabled and link works IE8 : disabled works, link fails (stay on same page instead of going to www.abc.com) FF : disabled fails, link works code with "return false": <a onclick="javascript: this.disabled = 1;return false;" href="www.abc.com"> IE6/7 : same as above IE8 : same as above FF : disabled fails, link fails Please help! Thanks, Ken. Hi! I have two input fields from who one of them i to upload image and other text field to upload image from url .I want to disable one of this fileds and to stay only one .For js code is helping me one friend but him help was enough and the code have some bugs,like fist fileds as active and them when check one has disable and opposite.I want this nly one field to be disable when the page is load but when checkbox is clicked .Sorry for my english .I hope you understand me. Code: <script type="text/javascript"> window.onload = function(){ var check = document.getElementById('check1'); var file = document.getElementById('file'); var text = document.getElementById('text'); check . onchange = function(){ if( check.checked ){ text.setAttribute('disabled', 'disabled'); file.removeAttribute('disabled'); } else{ text.removeAttribute('disabled'); file.setAttribute('disabled', 'disabled'); } }; }; </script> <input id="check1" type="checkbox" name="check" /> From link!!!<br/> Poster:<input id="file" type="file" name="poster" /> Poster from link:<input id="text" type="text" name="postlink" /><br/> I know it's expected behavior for disabled form elements not to post, because they cannot be successful. Fine. But even after I set disabled to false through a javascript function, the form elements will not get posted. Why is that? Does anyone know a workaround? Pseudo code he Code: <input type=text name=blah disabled=disabled /> function blah { all_blah = document.getElementsByName("blah"); for (i=0; i<all_blah.length; i++) all_blah[i].disabled = false; } The intended form elements change their looks in browser, meaning they're enabled, I got javascript to acknowlegde they're enabled, but they still won't post. Thanks for any insights. Hi I need to change the font color of the disabled textboxes of our application. These disabled textboxes exist at thousands of places both at pageload or disabled conditionally clientside. I am aware that in IE8 there is no other way to change the fontcolor except use readonly. So i thought that maybe if I changed the .disabled property to something like - Code: Object.disabled { function set() { this.readOnly = value; } function get() { return this.readOnly; } } then it would make my task much easier. I searched and found out that Object.defineProperty ,may do the trick. However i am getting the mull reference error. Is there any other way? Hi, I am currently detecting for Shockwave within IE by doing the following: Code: var isInstalled = false; if (window.ActiveXObject) { var control = null; try { control = new ActiveXObject('SWCtl.SWCtl'); } catch (e) { return; } if (control) { isInstalled = true; } } This works as expected and if it fails to detect Shockwave I tell the user to install Shockwave. The problem comes when AcitveX is disabled as it still returns the same message that it's not installed. I would prefer to be able to include an extra step to detect if ActiveX is disabled, in which case I can tell the user to enable it rather than giving them false advice. My only idea would be to detect for an ActiveX Object that every IE user should have installed. Any ideas on what that ActiveX Object could be or any ideas on how I could tackle this problem are greatly appreciated. Thanks A general question really, but does anyone have a good technique or source for creating disabled versions of tool bar buttons? Many thanks for any assistance, S I have a form that disables the radio options after choosing one and pressing a confirm selection button. Does the disabled attribute affect the value submitted? The Combo box which contains 10 elements with an attribute of 'multiple' and the size is 4 and in disabled mode. I need to display the 8th element in the viewing position or enable the scroll bar which is to view the 8th element ie combo box should be in disabled mode.
Hi! I have this form that depending on the shift you choose certain form elements get grayed out. Here's the part that I don't understand. I validate the form in php and display the errors but the form re-enables everything that was grayed out. Not the behavior I was expecting. How would I go about this? I attached a copy of the HTML source created from php. I'm grateful for any help! Thanks! The following code nicely gets the element ID for the element under the mouse on the mouse down event. It ignores a disabled element though I am assuming there is some way to get this done! Thanks in advance for any help, Wisar Code: // IE is retarded and doesn't pass the event object if (e == null) e = window.event; // IE uses srcElement, others use target _target = e.target != null ? e.target : e.srcElement; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; _elementId=targ.id?targ.id:targ.id; alert(_elementId); Hi! I couldn't find any information about this topic in the internet and I really wonder, how come people do not discuss it anywhere? Okay, jQuery works really great and offers many interesting effects, but what if you have JavaScript disabled? I mean I've browsed through several websites powered by jQuery with JS disabled and they doesn't work or behave weird. I know there aren't much people, who disable JS, but well I do want my page to be seen by all people in the end. I managed to do it with slider on my page (however I want to use other jQuery effects), but, for example, http://www.flowplaye...ools/index.html doesn't provide any information about this. Try to disable JS and see that nothing works. I can use <noscript></noscript> tag, but I have to make two main pages. And what if I want to view it on one page? What would you do? Regards, Aleks. Wasnt sure if I should post this in the JS or HTML forum. I am relatively new to web programming (1.5 years) and this question just occurred to me. I use jquery form validation to validate forms on my site. If my browser has javascript disabled, what is stopping someone from submitting crap through my form? I tried disabling javascript and submitting a form on my site and it posted. Is there a way to make it so if the user does not have javascript enabled the form cannot post? I have a form with 3 fields that will allow a user to search a database of clients by either name, email, or client id number. However, I would like the user to only be able to put information in one field. It can be done be either deleting the other two fields when the user inputs information into a different field, or by disabling the other two fields when the user enters information in one (and also frees up all fields if the user ends up deleting what they entered). I've searched and found several helps that were close to what I need but not exactly. I was wondering if anyone would be able to help. Below is a start of what I had. Basically, it will disable the fields when I mouse out of them but won't re-enable them when I mouse back in. As you can see, I tried various combinations of events. (My code below also doesnt null out the other fields when the user opts to use a different field than the one they first began to enter info in). Any help is much appreciated and if this needs more explanation I will try to clarify better. Thanks Code: <html> <head> <script type="text/javascript"> function makeDisable($ID){ var x=document.getElementById($ID) x.disabled=true } function makeEnable(){ var x=document.getElementById($ID) x.disabled=false } </script> </head> <body> <form name='selectclient' action='client_edit.php' method='get'> <table> <tr> <td align='right'>Client ID:</td> <td><input id='id' type='text' size='20' name='client_id' onmouseout="makeDisable('id')" onmouseover="makeEnable('id')" value='' /></td> </tr> <tr> <td align='right'>Client Email:</td> <td><input id='email' type='text' size='20' name='client_email' onblur="makeDisable('email')" onfocus="makeEnable('email')" value='' /></td> </tr> <tr> <td align='right'>Client Name:</td> <td> <select id='name' name='client_name' onblur="makeDisable('name')" onmouseover="makeEnable('id')"> <option value=''>-- Select --</option> <option value='1' >Ted</option> <option value='2' >David</option> <option value='3' >Zack</option> </select> </td> </tr> <tr> <td align='left'><input value='Edit' type='submit' name='submit' /></td> </tr> </table> </form> </body> </html> i m required to script the coding in which if we select an option from dropdown menu a text should be apprehend in disabled text field.. i dont have any idea about javascripting so sorry for being so dump... i need resultant in this form Hello, I have a script that enables a certain button when some conditions are met. I'm having an issue with it, so I made a simple script to get to the core of what I'm trying to do. This is the script that I'm using: Code: function disable() { document.form.button2.disabled='false'; } Code: <form name="form"> <input type="button" name="button1" value="Enable Button 2" onclick="disable()" /> <input type="button" name="button2" value="Button 2" disabled="true" /></form> Basically when you press button 1, button 2 enables. If I reverse it (button 2 enabled by default, pressing button 1 enables it) it is fine. But for some reason this way round nothing happens when I press button 1. What am I doing wrong? i have this slideshow, Swiss Army Image slideshow i got from DDrive. it has forward and back buttons that are disabled unless the Play/Stop button is in Stop mode. i cannot for the life of me figure out how to enable the buttons always. please can someone help? i have a maniac client who's now threatening not to pay because of this one thing!!! installation: http://cssphpmysql.com/dev/westermancm/library2.html js: http://cssphpmysql.com/dev/westermancm/js/swissarmy.js thanks so much! GN Hi everyone; I have created a JavaScript function to show either a enabled or a disabled text input field depending on whether a checkbox has been clicked or not. It works great for that purpose. However, when I use it for more than one text input field and I submit the form, it goes back to its disabled form. This is a problem if you by mistake submit the form without filling all the fields. As I said, the submit button makes the form go disabled. Is there a way to either not have the form go disabled after submission or to have a "Oncheck" function so I can use $_SESSION to keep the checked attribute? Thanks in advance for all your help Code: <html> <head> <style type="text/css"> #Active { display:none; } </style> <script type="text/javascript"> function toggle() { if (document.getElementById) { if (document.getElementById("checkbox").checked == true) { document.getElementById("Active").style.display = "block"; document.getElementById("Inactive").style.display = "none"; } else { document.getElementById("Inactive").style.display = "block"; document.getElementById("Active").style.display = "none"; } } } </script> </head> <body> <?php echo "Add Field"; echo "<input type=\"checkbox\" name=\"check\" id=\"checkbox\" onClick=\"toggle();\" value=\"v\"/>"; echo "<form method=\"post\">"; echo "<div id=Active>"; if(isset($_SESSION['test']) && $_SESSION['test']!="") { echo "<input name=\"test\" value=\"". $_SESSION['test']."\" type=\"text\" />"; } elseif(isset($_POST['test']) && $_POST['test']!="") { echo "<input name=\"test\" value=\"". $_POST['test']."\" type=\"text\"/>"; } else { echo "<input name=\"test\" type=\"text\"/>"; } echo "<input type=\"text\" name=\"test2\" >"; echo "</div>"; echo "<div id=Inactive>"; echo "<input type=\"text\" disabled>"; echo "<input type=\"text\" disabled>"; echo "</div>"; echo "<input type=\"submit\">"; echo "</form>"; $test = $_POST['test']; $_SESSION = $_POST['test']; $test2 = $_POST['test2']; $_SESSION = $_POST['test2']; echo $test; ?> </body> </html> |