JavaScript - How Would I Enable Colours Within A Text Box?
Title really say it all..
How would i enable colours within a text box? :$ Similar TutorialsIs it possible to create a text hyperlink with 2 different font colours in one word e.g. Hyper link so that the colours swap over when the mouse is placed over any part of the link i.e.. Hyper link . ? Using #FF6600 for orange and #006600 for green and by setting the css as follows: .graph a:link { color:#FF6600; text-decoration: none; } .graph a:visited { color:#FF6600; text-decoration: none; } .graph a:active { color:#FF6600; text-decoration: none; } .graph a:hover { color:#006600; text-decoration: none; } and then by applying a javascript rollover using a span inside the link I have been able to make one side of the link behave as desired, but not both sides. <span class="graph"><a title="graph" href="vml/patterdale-swirral-edge.htm">Hyper<span class="grn" id="span1" onmouseover="this.style.color='#FF6600'" onmouseout="this.style.color='#006600'">link</span></a></span> I would prefer to use just css, but a solution with javascript would be equally appreciated. I have a website, and I'[m learning Javascript. Somehow, I have to type a code in my browser like this javascript:enable:_Path Or something to enable the text box so that I can enter in it. Here is the details that I'm given. This below is in the actual website with the text box disabled ( cannot enter anything in it ) Code: <td width="40%"><strong><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH"));</script></strong></td> <td><input type="text" id="_path" maxlength="128" disabled style="width:140px;" /> <label id="desc" style="font-size:11px"><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH_DESC"));</script></label> </td> Below is me using Google Chrome to inspect the element, the text box. shareHost=document.getElementById("_shareHost"); path=document.getElementById("_path"); user=document.getElementById("_user"); pwd=document.getElementById("_pwd"); CheckRole(); So what do I type in the URL of my broswer to activate the _path form? Do I type javascript:document.getElementById("_path) OR ("path) IF I'm wrong, correct me the way I should do it. If theirs a program that allows me to do it easier, let me know. Dear All I have done some coding in javascript . Where i am generating the textbox field and checkbox dynamicaly . That is as per condition if there is one record match as per condition then that many text field will be generated So just to give a example , which is not dynamical What i want to do is first the text field are disable and when the checkbox is checked then the text box should be enable For 1 record the logic is working proper , but if there are more then 1 record then it does not work Can you'll please help <?php session_start();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" href="../locationpropertydesirecom/css/adcss1.css" type="text/css" media="screen" /> <script language="JavaScript"> function enable_text(status) { status=!status; var e=document.getElementsByTagName("tr"); for(var i=0;i<e.length;i++) { e[i].disabled = status; } } </script> </head> <body> <table> <tr> <td><input type="text" id="aa" name="a" disabled="disabled"/></td> <td><input type="text" id="aa" name="b" disabled="disabled" /></td> <td><input type="checkbox" name="aa" value="check" onclick="enable_text(this.checked)" /> </tr> <tr> <td><input type="text" name="a" disabled="disabled"/></td> <td><input type="text" name="b" disabled="disabled" /></td> <td><input type="checkbox" name="aa" value="check" onclick="enable_text(this.checked)" /> </tr> </table> Thanks , regards Jim Brand new to the forum, so first off... Hello all!! I have been working on a project which randomly changes the text font of a word submitted (Color and Size). At present the code works fine, using the below Javascript. Code: <SCRIPT LANGUAGE="JavaScript"> function randomise(){ var words=document.myform.wordlist.value; var spacer=""; words=words.split(document.myform.randomiseby.value) document.myform.code.value=" "; var colourscheme=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F") for(var time=0;time<=(words.length-1);time++){ {var c1=Math.round(Math.random()*(colourscheme.length-1)); var c2=Math.round(Math.random()*(colourscheme.length-1)); var c3=Math.round(Math.random()*(colourscheme.length-1)); var c4=Math.round(Math.random()*(colourscheme.length-1)); var c5=Math.round(Math.random()*(colourscheme.length-1)); var c6=Math.round(Math.random()*(colourscheme.length-1)); var size=1+Math.round(Math.random()*6); document.myform.code.value+="<font color=\"#"+colourscheme[c1]+colourscheme[c2]+colourscheme[c3]+colourscheme[c4]+colourscheme[c5]+colourscheme[c6]+"\" size=\""+size+"\">"+words[time]+"</font>"+spacer+" "; } } looks_like.innerHTML=document.myform.code.value; } </script> To really highlight the text i would like to keep the font white and change the background colour but i don't have a clue how to do it... Please note: i am a complete noob to Javascript and the above code has been bodged together from a number of tutorials. Can anyone help? Hi there, Where I work there are certain dates where nothing can be done, certain times where work can be done with caution, and dates where work can be done. I want to put on the site a traffic light that would change colours based on the calendar dates where work can/can't be done. For example, if April 11th there is stuff to do, the traffic light would be green. But April 12th, there isn't work to do, it would turn red. Do you know how I would go about doing this? I am trying to make it so if a PHP session entity exists, then JavaScript will enable a button. I am having trouble getting this to work and wondering if anyone knows what I am doing wrong? Code: function purchaseEnable() { if ($_SESSION['order']['paymentmethod']) { document.getElementById("purchase").disabled = false; } } Code: <INPUT disabled id="purchase" type="submit" value="PURCHASE"> can we enable javascript through code
Hi I have a form where I want to force users to accept terms and conditions before they can move on to the next page (submit form). Code: <input tabindex="2" name="agreement" id="agreement" type="checkbox" value="N" onchange="checkAgreement()" /> <label class="checking" for="agreement">I accept the <a tabindex="1" href="?page_id=292" title="read this before you continue" class="popmeup">terms and conditions</a>.</label> <!-- the button to be enabled --> <input tabindex="3" type="button" name="confirmer" value="Confirm" onclick="confirmOrder()" disabled="disabled" /> and the JS that works fine in Firefox. IE enables the button, but it still "looks" disabled, hence it is unlikely that anyone clicks it. Code: function checkAgreement() { if(document.order_form.agreement.checked) { document.order_form.confirmer.disabled = false; //document.order_form.submit.disabled = false; document.order_form.agreement0.value = "Y"; //for testing //document.order_form.confirmer.value = document.order_form.agreement0.value; } else { document.order_form.confirmer.disabled = true; //document.order_form.submit.disabled = true; document.order_form.agreement0.value = "N"; //document.order_form.confirmer.value = document.order_form.agreement0.value; } } any ideas? 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...................... i am making a registration page for my website and for validation using javascript...is there any way to know on my client side javascript enable or not....
Hello, I am trying to write a piece of code which re enables ctrl c and ctrl v on a paticular page. Here is the source: Code: function disableKeys() { switch ( event.keyCode ) { case 88: //Capture X case 67: //Capture C case 86: //Capture V case 65: //Capture A case 70: //Capture F case 83: //Capture S case 69: //Capture E case 73: //Capture I case 72: //Capture H if (window.event.ctrlKey) { event.cancelBubble = true; event.keyCode = 578; event.returnValue = false; } break; } } I'm sorry I'm not very familiar with html. I figured I could just change the returnvalue to true but it didn't seem to work. Hi there. I came across this forum while searching for an example of how to do something in Javascript, and found the post helpful, but didn't quite answer my query completely... It was a very old thread, few years old, though so I thought best not to revive it from the murky depths Basically, I very rarely use JavaScript... in fact, I rarely do any programming at all, but I'm trying to build a basic site at the moment, and I'm wanting to disable/enable a text box based on the value of a drop down menu... The idea behind it is that I have a sub title, and in the admin panel, I want to be able to set whether the sub title is picked randomly from a database, or whether it chooses one, and only one... So in the admin panel, I've got a page that has a drop down menu with two options. Static, and Random. Below this, I've got a text box called Static ID... In this text box, the administrator would insert the database row ID for the specific sub title they want... Obviously this Static ID field only applies if you select a Static sub title, rather than a Random sub title... So what I want to happen is for the text box to be disabled if the drop down menu is selected as Random... and then enabled if the drop down is selected as Static... So I came across the following script on an old post as mentioned earlier: Code: <script type = "text/javascript"> function enableTextbox() { if (document.getElementById("dropdown").value == "New") { document.getElementById("txt1").disabled = false; } else { document.getElementById("txt1").disabled = true; } } </script> <form action="adm_subtitle.php" method="post"> Static or Random? <select name="staticrand" id"staticrand" onchange="enableTextbox()"> <option value="static">Static</option> <option value="rand selected="selected">Random</option> </select> Static ID <input type="text" value="0" name="staticid" id="staticid" maxlength="3" disabled="true" /> <input type="submit" name="submitsubtitleset" value="Submit" /> </form> With a bit of other formatting that isn't necessary for this example... Now, this works if I change the drop down box to Static, it'll enable the text box, and then disable the text box if I select Random... The problem I've got though, is with a bit of PHP code mixed in with the form, it will check the current value of the setting, and then choose which drop down menu to pick as selected... so if in the backend config it's set to "rand", it'll automatically pick Random when the page loads, and if it's set to "static", it'll automatically pick Static when it loads the page... If it's already set to Static, the page loads and the text box is disabled. I have to select Random from the drop down list, and then select Static again to enable the box... Is there anyway that I can enable it if Static is already selected when the page loads and then disable it when Random is selected, but still keep the functionality that it is already disabled when the Random option is selected on load? I hope that makes sense... Cheers, Mike. I want to build functionality like that (see http://www.cymaxstores.com/Common/Pr....aspx?ID=26094) is it possible with only javascript , or ??? I dont have any clue plz help any help would be appreciated Thanks sknaht Hi, I have two buttons save and finish. I want to enable the button finish whenever I click the save button. page1.jsp. <script> InitialLoad() { document.getElementById('finish').disabled = true; } save(){ document.getElementById('finish').disabled = false; } </script> <html> <body onload= "InitialLoad()"> <input type="submit" name="finish" id=="finish" value="finish"> <input type="submit" name="save" value="save" onclick= save();> </body> </html> strutsconfig.xml <forward name="success" path="atre.dodUpgrade.show.page1"/> Using the above I can enable it temporarly. But whenever I call the forward page it on action class forward = mapping.findForward("success"); The Problem is page Refresh again and it shows disabled button for finish. what could be the solution for this? Thanks hello, i have this script that doesn't work exactly right yet. but i can't figure it out what i need to chance to let it work. in the script i want the button to be enabled when both text boxes are filled, atm when i fill in 1 it will already enable the button and thats exactly what i don't want. im quite a nooby in this so could some1 help me ? tyvm in advance code___________________ <html> </head> <script type="text/javascript"> function ButtonDisable1(text) { if (text.length > 0) document.getElementById("submit_button").disabled = false; else document.getElementById("submit_button").disabled = true; } </script> </head> <body> <input type="text" id="search_text" onchange="ButtonDisable1(this.value)"> <input type="text" id="search2_text" onchange="ButtonDisable1(this.value)"> <input type="submit" id="submit_button" value="Search" disabled="true"> </body> </html> 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.
I have a telephone input on my form. It is an optional input for users. The prompt begins with the user having to select a phone type from a select menu, and then continue to the text fields to enter the digits. I would like to have the text fields disabled unless any of the types of phone are selected, but not if a type isn't selected. Here's my HTML code so far: Code: <select name="phoneType1"> <option value="" selected="selected">Type...</option> <option value="Home">Home</option> <option value="Work">Office</option> <option value="Cell">Cell</option> </select> (<input type="text" id="phAreaCode1" name="phAreaCode1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phPrefix1')"/>) - <input type="text" id="phPrefix1" name="phPrefix1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phLine#1')"/> - <input type="text" id="phLine#1" name="phLine#1" size="5" maxlength="4"/> ext.<input type="text" name="phExtension1" size="4" maxlength="4"/> I know that all I need to do to disable the text fields is to type in "disabled" before the name of the field. But, I don't know how to enable it when "Home," "Office," or "Cell" is selected. Thanks for any help. 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'm having trouble programming a radio button to enable a group of checkbox options. I want the group to be disabled unless the radio is selected. Can I use: Code: document.getElementById("").disabled=true/false for a <div> section? Here's what I have so far. function: Code: function disableSection() { if (document.forms.radio.checked) document.getElementById("optionalinfo").disabled = false; else document.getELementById("optionalinfo").disabled = true; } HTML: Code: <input type="radio" name="additionalinfo" value="yes"/>Yes! Please sign me up for the following items:<br/> <div><blockquote><input id="optionalinfo" type="checkbox" name="additional" value="newsletter"/> I wish to receive <font color="ff69b4"><i>AMT</i></font>'s monthly E-Zine, <b>"Glorious Morning Muffins"</b>.</br> <input id="optionalinfo" type="checkbox" name="additional" value="Updates"/> I wish to receive <font color="ff69b4"><i>AMT</i></font> updates.</br> <input id="optionalinfo" type="checkbox" name="additional" value="future"/> Keep me posted about future offerings at <font color="ff69b4"><i>AMT</i></font>.<br/> <input id="optionalinfo" type="checkbox" name="additional" value="userRegister"/>I need to register to log in</blockquote></div> In addition to this, I would like the section to fade when disabled. Thanks for any help... again! I have a form that only shows the submit (update) buttons if the value select field beside it is changed. But what is someone has JS disabled, how can I enable them? Code: <select title="3553" name="3553" onchange="JavaScript:document.cart.add3553.disabled=false;"> |