JavaScript - Spell Check Button
Hey, everyone! I was wondering if there was anyway to make a spell check button with JavaScript?
I had an idea to disable spell check and then add a button so the user could click it to use spell check...or at least reveal the misspelled words. I'm sure that it's possible. In fact, I have a general idea of how it might be accomplished, but I'm not a JS coder so I don't know exactly how to make it work. Could anyone help, please? - Lono Similar Tutorialshi, can anyone help me with spell check code.. i want to implement spell check inside a text-area and i want an inline code, i cannot call .js files .. if anyone can give me a solution for this i'd be very grateful.. i did find a code but im not sure how to use it in my html page can anyone help me with a javascript spellchecker ...... i have a text-area and i want a javascript code tht can check spellings when i write , like we see in gmail, or similar ... 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 Visitors enter information in textarea's and form fields and I wish to allow them to have this spell checked before submitting. What methods are open to me to do this. Hi all, This code works to place a mark in a radio button (check one) in a "restored" form: Code: for (var q=0;q<document.Simple.Colors.length;q++) { if (document.Simple.Colors[q].value == document.Restored.Colors.value) { document.Simple.Colors[q].checked = true ; break; } I'm curious why it won't work for a check box (check more than one): I figured it would be the same... no? Thanks, ~Wayne I currently have this script, I need it to check when I click the checkall button. Hm... now for some reason the select all button isnt working... Current code: Javascript: Code: <script type="text/javascript"> function checkall(chek) { for (i = 0; i < chek.length; i++) chek[i].checked = true; } </script> <script type="text/javascript"> function uncheckall(chek) { for (i = 0; i < chek.length; i++) chek[i].checked = false; } </script> PHP: PHP Code: <?php error_reporting(E_ALL); require("inc/config.php"); if (isset($_POST['del'])) { for ($count = 0;$count<count($_POST[delchk]);$count++) { $delete = $_POST[delchk][$count]; $query = "DELETE FROM persons WHERE id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } $result = mysql_query("SELECT * FROM persons"); // Check how many rows it found if(mysql_num_rows($result) > 0){ echo "<table id=\"mytable\"> <thead> <tr> <th align=\"center\" scope=\"col\">Delete</th> <th align=\"center\" scope=\"col\">First Name</th> <th align=\"center\" scope=\"col\">Last Name</th> <th align=\"center\" scope=\"col\">High Scores</th> <th align=\"center\" scope=\"col\">Date of Entry</th> <th align=\"center\" scope=\"col\">IP Address</th> </tr> </thead> <tbody>"; echo "<form name = 'myform' action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "<tr align=\"center\">"; echo '<td><input type="checkbox" id="delchk" name="delchk[]" value="'.$row['id'].'" /></td>'; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td><a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Check HighScores</a></td>"; echo "<td>" . $row['AddedDate'] . "</td>"; echo "<td>" . $row['Ip'] . "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "<hr>"; echo "<input type='submit' name = 'del' value='Delete Selected'></form>"; echo "<input type='button' onclick='checkall(document.myform.delchk);' value='Select All'>"; echo "<input type='button' onclick='uncheckall(document.myform.delchk);' value='UnSelect All'>"; } else{ // No rows were found ... echo "No Registered Members"; echo "</tbody>"; echo "</table>"; } mysql_close($con); ?> I have 3 check boxes and one submit button when the submit button is hit I need it to direct to one of 3 pages depending on which check box is checked. can anyone help with this Thanks! Hey All! I've been having problems trying to figure this out and my nooby skills can only go so far... Basically I have a page that allows a user to select a specific category which links them to another page that has a series of radio buttons. By default I want to have that category checked according to what they selected. I've been able to pass the category variable with no problem but can't get it to default check... So far my Javascript looks like this: Code: <script type="text/javascript"> var category = category3 function autoForm(){ var searchForm = document.getElementById('myform'); var searchInput = searchForm.getElementsByTagName('input'); if(searchInput.value == category){ searchInput["group"].checked = true; } else { searchInput["group"].checked = false; } } <script> And so I'm trying to search with that function the value rather than the name. Here is my HTML: Code: <body onload="autoForm();"> <form id="myform" name="myform" action="#" method="POST"> <div align="center"><br> <input type="radio" name="group" value="category1"> Milk<br> <input type="radio" name="group" value="category2"> Butter<br> <input type="radio" name="group" value="category3"> Cheese<br> <input type="radio" name="group" value="category4"> Bread<br> </div> </form> </body> </html> I'm not getting any javascript errors, but nothing is really happening. So ultimately I want it to default select whatever the category variable (in this case "category3") when the user opens up the page. I'm trying to learn javascript right now so I'd love to hear how this is failing and how to do it right. I spent soooo long trying to figure this out. [woot! first post] iframe Info: id="AssessmentsIFrame" button Info: id="wpv_1266351" 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 Hey guys. This is vague because I dont know what exactly to tell you but please reply with me so I can fix this. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS Hey guys. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS i'm still a relative noob and this has me stuck - i have a save button with a "save as copy" in the save dropdown list. add new item directs to a premade/formatted project that is used as a template, so on that item i only want/need the "save as copy" but on all other items that use the form i need to only have the "save" function. is there any way to either change the function of the button depending on item that is being viewed in the edit screen OR hide the "save" button and only show the button associated with "save as copy - and vis versa for the rest of the items?? current button code is - protected function getToolbar() { $options = array(); $user = JFactory::getUser(); $create_ms = $user->authorise('core.create', 'com_pfmilestones'); $create_task = $user->authorise('core.create', 'com_pftasks'); $options[] = array( 'text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array( 'text' => 'Save as new project', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => ($this->item->id > 0))); PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); item used as template is id=8 any help or suggestions would be greatly appreciated.. Hi, I am not entirely sure what I am doing wrong here, and I have been looking at this for ages, so apologies in advance if I have become so bleary eyed I can't see something simple. I use php to create buttons based on values pulled for a table. The problem I have is when you click on the first button the javascript function works great, when you click on the next button you get the same output even though it should be different results. I am working in ff and I can see on my firebug console that the javascript function is being called, but it is not passing the new value of the second or third button, it just keeps repassing the value of the first button. So not entirely sure where I am going wrong here. My page is: Code: <script type="text/javascript"> function loadXMLDoc2(File,ID,Msg){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } var params=Msg; xmlhttp.open("POST",File,true); xmlhttp.setRequestHeader("Pragma", "Cache-Control:no-cache"); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", params.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(params); } </script> <head> <body> <?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydb", $con); $result = mysql_query("SELECT DISTINCT theme FROM goods WHERE category='{$_POST['category']}' ORDER BY theme DESC"); while($row = mysql_fetch_array($result)){ echo '<input type="text" class="hidden" name="theme" id="theme" value="' . $row['theme'] . '" ><input type="button" class="button3" name="product" id="product" value="' . $row['product'] . '" onClick="loadXMLDoc2(\'getShow.php\',\'txtHint\',\'theme=\'+encodeURI(document.getElementById(\'rtheme\').value))" > '; } echo '<br /><br /> <div id="txtHint"><div> <br /> <br />'; mysql_close($con); ?> And getShow.php produces a table with a list of product images, names and prices, based on theme. So basically not sure where I am going wrong here? i got javascripts button : Code: <input type="button" value="select" onClick="document.getElementById('input').select()" /> how can i transform "button" to image button (gif) I have 4 rows in a table. Each row consist of 4 radio buttons. Each radio button per row has different values in it but has the same name (group) ex: <input type="radio" name="a" value="1"> <input type="radio" name="a" value="2"> <input type="radio" name="a" value="3"> <input type="radio" name="a" value="4"> <input type="radio" name="b" value="1"> <input type="radio" name="b" value="2"> <input type="radio" name="b" value="3"> <input type="radio" name="b" value="4"> and so on.. If I click radio button A with value 2, I want to output the total at the bottom as "2".. Also, if I click radio button B with value 3, I want to output the total of A and B as 5 and so on.. How can I automatically calculate the answer based on which radio button was click? update: I got my answer from this site: http://stackoverflow.com/questions/1...s-using-jquery 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) 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> 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. This is the code part that fails it's if check. Code: while (n<=30) { var slot='#slot'+n; $( slot ).data({no: n, id: itemId[i], name: itemName[i], equip: itemEquip[i], lvl: itemLvl[i], bonus: itemBonus[i], rstr: itemRStr[i], rdef: itemRDef[i]}); $( slot ).draggable({ handle: slot, stack: slot, revert: "invalid", snap: "div#"+itemEquip[i], snapMode: 'inner', start: function(event, ui) { $('div#'+$(this).data('equip')).css({'border': '2px dashed #0066CC', 'background': 'rgba(255,255,255,0.2)'}) .droppable ({ drop: function(event, ui) { if (pLvl>=$('.ui-draggable-dragging').data('lvl') && pStr>=$('.ui-draggable-dragging').data('rstr')) { alert(pLvl+", "+$('.ui-draggable-dragging').data('lvl')); $('.ui-draggable-dragging').css({'display':'none'}); $('div#'+$('.ui-draggable-dragging').data('equip')).html ( "<img src='items/equipped/"+$('.ui-draggable-dragging').data('name')+$('.ui-draggable-dragging').data('id')+".png' />" ) $.ajax({type:"GET", url:"items/change.php", data:"id="+$('.ui-draggable-dragging').data('id')+"&no="+$('.ui-draggable-dragging').data('no'), cache:false, timeout:5000, error: function() { $('div.nogood').html ( "There was an error. Please inform us about it in the forum." ).css({'width':'400px','margin-left':'-200px'}); $( 'div.nogood' ).fadeIn(500, away); function away() { $( 'div.nogood' ).delay(2000).fadeOut(500); }; } }); } else { alert("HUh"); $( 'div.nogood' ).fadeIn(500, away).css({'width':'400px','margin-left':'-200px'});; $('.ui-draggable-dragging').draggable({revert: true}); if (pLvl<$('.ui-draggable-dragging').data('lvl')) { alert("Good"); } else if (pStr<$('.ui-draggable-dragging').data('rstr')) { $('div.nogood').html("Not enough strength.") } function away() { $( 'div.nogood' ).delay(1400).fadeOut(500); }; } } }); }, stop: function(event, ui) { $('div#'+$(this).data('equip')).css({'border':'none', 'background':'transparent'}).droppable("destroy"); } }); n++; i++; } This if comparison if (pLvl>=$('.ui-draggable-dragging').data('lvl') && pStr>=$('.ui-draggable-dragging').data('rstr')) somehow goes through. After the if statement I check the values with the alert but it displays 5 for pLvl and 10 for the draggables data (which are the correct numbers) so can anyone tell me why does this if statement still go through when pLvl is lower? |