JavaScript - Wanting A Spell Checker For My Sites
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. Similar TutorialsHey, 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 hi, 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 ... Been working my *** off on this for a few days trying to keep updating it to make it most efficient with everything I learn... I'm quite proud of it so far considering I'm not actually the best coder lol most JS and PHP confuses the crap outa me unless I do it from scratch. So anyways here is the link. Tell me what you think. Suggestions would be amazing. I'd love to know what I screwed up as long as you explain in detail as to why and how to fix it. I really hate when people hand me a huge snippet and expect me to understand it -_- Thanks Shelby LINK http://opentech.durhamcollege.ca/~in...rittains/labs/ (Its an interface to display my school web design labs... the interface it self has almost NOTHING to do with school work as my labs are mostly based off php and we don't even touch JS till the third year =[ so its safe ^.^ so don't worry I'm not asking you to do my school work ^.^) I have been trying to learn javascript for the last few weeks and have come to a brick wall in my thinking. Could you look at this code and tell me where I am going wrong? I would prefer for you to point out what type of an issue I have and the basic syntax of what I am trying to do. This enables me to look at the problem, digest the type of problem and put together an idea of the way to fix the code. my code (with errors on purpose) Code: <html> <head> <title> <script type=text/javascript src=blah.js></script> </head> <body> (and so on) The response type of response I would like to see is - (from the helper) check to see if you have closed all your lines with the </sectiontype> you need to double check your format on line 4. The correct format would be <script type="type of script" and the src="scriptname.js">. I really appreciate any help you can provide. I just cannot figure a few things out and am getting confused as to how to fix my problems. Code: <!DOCTYPE html> <html> <head> <title>The Italian Job</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" > //src="italianjob.css"> //Set up array that represent the car storage space in cubic inches var car_type = new Array(); car_type["2door"]=41446; car_type["4door"]=52776; //Set up array that represents the metal_type weight var metal_type= new Array(); metal_type["selectmetal"]=0; metal_type["Aluminum"]=4.3512; metal_type["Gold"]=30.9912; metal_type["Platinum"]=34.09692; metal_type["Silver"]=16.8276; // getCarStorage() finds the storage based on the car storage space. function getCarStorage() { var carStorageArea=0; //refers form id="carForm" var theForm = document.forms["carForm"]; var selectedCar = theForm.elements["selectedCar"]; //Here since there are 2 radio buttons selectedCar.length = 2 //We loop through each radio buttons for(var i = 0; i = selectedCar.length; i+) { //if the radio button is checked //if(selectedCar[i].checked) { //by using the car_type array //We get the selected item value such as car_type["4door".value]" carStorageArea = car_type[selectedCar[i].value]; //If we get a match then we break out of this loop break; } } //We return carStorageArea return carStorageArea; } //This function finds the metal bar weight function getMetalDensity() { var carStorageSpace=0; //Get a reference to the form id="carForm" var theForm = document.forms["carForm"]; //Get a reference to the select id="metal" var selectedmetal = theForm.elements["metal"]; //equal to value user chose such as metal_type["Aluminum".value] would be equal to 4.3512 carStorageSpace = metal_type[selectedmetal.value]; //finally we return carStorageSpace return carStorageSpace; } function calculateTotal(); { //Here we get the total by calling our function //Each function returns a number var carUsed = getCarStorage() / 440; var howMany = carUsed * .33; var fit = car_type / 44.4; var weightBars = 1800 / metal_type; var total = weightBars * metal_type; var barLimit = carUsed - howMany; var weightLimit = howMany - weightBars; var divobj = document.getElementById('total'); if (barLimit <0) { document.write("<This will not work."); } else if (weightLimit <0) { document.write("This will not work."); } else respond = 'With the total cargo area of the chosen car, you are able to fit ' +carUsed.toFixed(0) + ' bars in it. Due to weight limit of 1800 lbs, you are limited to ' + weightBars.toFixed(0) + ' bars in the cargo area. The weight of the bars you want to have onboard the car is ' + total.toFixed(2) + ' \n'; return respond} </script> </head> <body style="background-color:burlywood" > <!-- onload="hideTotal()" --> <p>In <em>The Italian Job</em>, theives were able to steal bars of gold by loading them into Mini Coopers and driving away.</p> <p> It is now your turn to pull your own version of <em>The Italian Job</em>. You are able to choose what model of Mini you use and the type of metal bar you want to steal. Thes rules a <ul> <li>You can only load the cargo area of your Mini 1/3 of the way full</li> <li>The cargo area used cannot weigh more than 1800 lbs.</li> </ul> <form id="carForm" onsubmit="return false;"> <label>What car do you want to use?</label> <br /> <label class="radiolabel"> <input type="radio" onclick="calculateTotal()" value="2door" name="selectedCar" /> 2 Door Mini - 25.4 cubic inches of cargo space </label> <br /> <label class="radiolabel"> <input type="radio" onclick="calculateTotal()" value="4door" name="selectedCar" /> 4 door Mini - 35 cubic inches of cargo space </label> <p>Now you get to choose which metal you wish to steal. </p> <select id="metal" onchange="calculateTotal()" name="metal"> <option value="selectmetal">Select the metal bar type</option> <option value="Aluminum">Aluminum</option> <option value="Gold">Gold</option> <option value="Platinum">Platinum</option> <option value="Silver">Silver</option> </select> <br /> </form> <div id="total" style="display: selectmetal;"> </div> </body> </html> So I'm picking up on a project that was left off by another developer. He developed the search engine for this website using mustache.js as a templating plugin. However, I have this giant if/else statement in the Javascript to implement it in the template.. but it's ugly in my opinion so I'm curious on if anybody has a better way of going about this. Here is my template in the view: Code: <script id="search_result_item" type="x-tmpl-mustache"> <div id="Box_Book1" class="clearfix search-result-item"> <a href="{{encore_url}}"> <img id="Image1" src="{{ image_url }}" onerror="this.src = 'http://origin.syndetics.com/index.php?upc=x/MC.gif&client=stlip&type=hw7';" class="image {{material_type}}" /> <span class="{{ label_class }}">{{ label_text }}</span> </a> <div class="title-container"> <span id="textspan5" class="more-details"> <a href="{{ encore_url }}" target="_blank">+ More Details</a> </span> <div class="text-title1-container"> <p class="title"> {{ title }} </p> </div> </div> <p id="Text_Author1"> {{ author }}<br /> </p> </div> </script> Here is my Javascript that is rending into the template: Code: // this is gnarly i know..hopefully temporary var item_type = result.material_type; var label_class; var label_text; // This needs rewritten too once search is written in different format if(item_type == 'z') { // EBook label_class = 'ebook'; label_text = 'EBook'; } else if(item_type == 'w') { // EAudio label_class = 'eaudio'; label_text = 'EAudio'; } else if(item_type == 'x') { // EVideo label_class = 'evideo'; label_text = 'EVideo'; } else if(item_type == 'h') { // EMagazine label_class = 'emag'; label_text = 'EMag'; } var css_image_class = args.material_type; if (css_image_class == '24_7_online_library') { css_image_class = 'online_library'; } var template_args = { 'image_url' : image_url, 'error_image_url' : error_image_url, 'author' : result.author, 'title' : result.title, 'year' : '(' + result.year + ')', 'encore_url' : encore_url, 'material_type' : css_image_class, 'label_class' : label_class, 'label_text' : label_text }; div.html(Mustache.render(result_item_template, template_args)); Thank you for any ideas on how to make it prettier.. the item_type is what's terrifying ugly to me. I have a js counter which keeps track of how many chars are in a field on an asp form. When the user clicks a button further down in the form, the form generates more fields. This also causes the js counter to reset to its original value, as the page is 'reloading' in a way. How can I check this value and keep it the same when the user clicks this button? I am including the code I have, if anyone has any ideas/suggestions thanks javascript Code: <asp:Content ID="Content1" ContentPlaceHolderID="headContent" runat="server"> <script type="text/javascript"> //limit of chars var lim = 128; function count(a) { //difference count var dif = lim - a.value.length; while (dif < 0) { a.value = a.value.replace(/.$/, '') dif = lim - a.value.length; } //display difference count document.getElementById('myspan').firstChild.data = dif; } </script> counter in code Code: <asp:TextBox ID="txtHeadline" runat="server" Width="600px" MaxLength="128" CssClass="VariableText" onkeyup="count(this)"></asp:TextBox> </td> <td valign="middle" width="160px"> <asp:Label ID="Label14" runat="server" Font-Bold="True" Font-Names="Tahoma" Font-Size="8pt" Text="Characters Remaining: " Width="130px" CssClass="LABEL" Height="16px"></asp:Label> <span id="myspan" Font-Names="Tahoma" Font-Size="8pt">128</span> button Code: <asp:Button ID="btnInitializeTemplate" runat="server" OnClick="btnInitializeTemplate_Click" Text="Initialize Template" CssClass="LABEL" /> i have tried Code: <asp:Button ID="btnInitializeTemplate" runat="server" OnClientClick="return count(document.getElementById('txtHeadline'));" OnClick="btnInitializeTemplate_Click" Text="Initialize Template" CssClass="LABEL" /> it compiles but the value remains reset. any advice on what im doing wrong? I have used this script successfully: http://www.javascriptkit.com/script/...2/refer2.shtml However, is there a way to block the following work-around (example only): http://www.their-url.com/redir.php?u...ww.my-url.com/ The redir.php makes it possible to get past the script. I badly need a Javascript syntax checker for my Javascript. Any suggestionss will be gratefully received. Frank Hi, I have good script Code: <script type="text/javascript"> function chkcontrol(j) { var total=0; for(var i=0; i < document.form1.opt.length; i++){ if(document.form1.opt[i].checked){ total =total +1;} if(total > 11){ alert("No more than 11 please") document.form1.opt[j].checked = false ; return false; } } } </script> But this script works only If I have: <input type="checkbox" name="opt" value="1" onclick='chkcontrol(1)'>Opt 1 <input type="checkbox" name="opt" value="2" onclick='chkcontrol(2)'>Opt 2 I need to proces this form with PHP so, when I change opt to opt[] (<input type="checkbox" name="opt[]"..) script doesnt work anymore. Couldnt find any script for it, so help me if you can. Thank you hi i want to create one java code that do this : 1-one counter is counting 20 to 0. 2-if counter 0 then choose random string between "click one" , "click two" , "click three" and show it. 3-in other table we have three button that name`s are "one" , "two" ,"three". 4-for continue page user must click true button,if user click false button alert "wrong". thx Hello, I'm building a simple custom dropdown menu for a web-site so that I can control look and feel as well as the behavior of an iframe. I've set it up so that when the user clicks on any of the menu's active components, an "if" sequence in the clickHandler() function is activated that gets the element's class. If the event occurred on a dropdown option, the event-target id is checked, and the appropriate function is called. At least this is how it's supposed to work. All of the drop-down options have been assigned the "dmo" class. When I test the menu and click on other elements, it works fine. But when I click the "dmo" drop-down options, nothing happens. Firebug and IE Explorer Developer Tools both show no errors, but on clicking a dropdown option, the correlate code doesn't run at all, and after hours of head-banging, I have no idea why. I need help on this one. Here's the code. Code: <!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> <style type="text/css"> BODY { background:#000; } .DropMenu { width:228px; height:1.5em; } .DropMenu span { color:#FFF; font-size:0.875em; font-family:Verdana, Geneva, sans-serif; font-weight:bold; } .DropMenuLabel { float:left; width:85px; height:1.5em; padding:0.2em 0 0 0; text-indent:0.3em; } .DropMenuTopList { width:130px; float:left; height:1.5em; padding:0 0 0 0; cursor:pointer; } .DropMenuTopList img { padding:0.4em 0 0 0.3em; cursor:pointer; } .DropMenu span { color:#FFF; font-size:.875em; font-family:Verdana, Geneva, sans-serif; font-weight:bold; vertical-align:center; } #dropMenuButton { cursor:pointer; } #dropMenuOptions { position:relative; width:130px; left:85px; padding:0.2em 0 0 0; visibility:hidden; cursor:pointer; } .MenuList { list-style-type:none; top:0; left:0; width:100%; margin:1.5em 0 0 0; padding:0; } .MenuList li{ height:1.5em; margin:0.2em 0 0 0; padding:0; width:100%; background-color:#666; border-color:#AAA; border:0.5px solid; text-indent:0.3em; } .dmo { z-index:100; } </style> <script type="text/javascript" language="javascript"> window.onload = function() { setBehavior(); } function setBehavior() { /* var downButton = document.getElementById('dropMenuButton') downButton.onclick = new Function ( "showMenu()" ); */ window.onclick = new Function ( "evt" , "clickHandler( evt )" ); } function clickHandler( evt ) { var dropMenu = document.getElementById('dropMenuOptions'); var e = evt; var targ; if (e.target) {targ = e.target} else if (e.srcElement) {targ = e.srcElement} var targClass = targ.getAttribute('class'); /* classnames dmb - dropdown button - this should toggle the dropdown visibility on and off on click, and toggle visibility on over/out dmo - option - once clicked, this should turn the dropdown visibility off */ var exclude = ("dmb" || "dmo") if (targClass != exclude ) { hideMenu() } else if (targClass == "dmb" ) { if (dropMenu.style.visibility == "visible") { hideMenu() } else showMenu(); } else if (targClass == "dmo" ) { if ( targ.id == "option1" ){ window.open(www.bing.com,"Bing") } else if ( targ.id == "option2" ){ window.open(www.bing.com,"Bing") } else if ( targ.id == "option3" ){ window.open(www.cuil.com,"Cuil") } hideMenu(); } } function showMenu() { var dropMenu = document.getElementById('dropMenuOptions'); dropMenu.style.visibility= "visible"; } function hideMenu() { var dropMenu = document.getElementById('dropMenuOptions'); dropMenu.style.visibility= "hidden"; } </script> </head> <body> <div id="customMenu" class="DropMenu"> <span> <div class="DropMenuLabel">Options:</div> <div class="DropMenuTopList dmb" id="dropMenuTopList">Temp Text <img class="dmb" id="dropMenuButton" src="Assets/Buttons/DropMenuDownButton.png"> </img> </div> <div class="dmo DropMenuOptions" id="dropMenuOptions"> <ul id="menuList" class="dmo MenuList"> <li id="option1" class="dmo">Option1</li> <li id="option2" class="dmo">Option2</li> <li id="option3" class="dmo">Option3</li> </ul> </div> </span> </div> </body> </html> In your opinion, How the google puts its ads on the other sites? Do you think the google creates a new 'iframe' tag and puts Ads on it ? Or the google uses another ways to puts ads on sites? Please help me. With Regards.Mojtaba I'm making 2 sites and need a visitor who lands on the home page of either site to first be shown a page that shows a company introduction and 2 links at the bottom so they can choose which division of the site (which website) they want to go to. Does anyone know of any pre-made java or other code that would allow for this? So that a visitor doesn't get stuck in a cycle of being taken from one home page to the other and having the pop-up every time, I'm thinking it will likely need to write a cookie saying they've seen the pop up, then it won't appear again. Each site would then have to check for a cookie from either site. Does anyone have any ideas on how to make this work? I'm open to anything and have to have it done by friday Please, I need a code that is capable of preventing SEOQuake from loading on my websites, even if a user has installed the plug-in. For example, Google, Yahoo and Bing implements such feature. I just don't want it to load whenever anybody visits my sites. Here is my issue: I am opening a popup from the main browser window, where the use logs in to a 3rd party site. After logging in, the popup window is being redirected to our site, where I have to send back a message to the original window. I am using window.opener for sending the message. Everything works fine in IE*/Firefox/etc, but if the 3rd party site is added to the trusted sites in IE, the window.opener won't work anymore. Why does this happen? How could this be resolved? Thanks in advance, norbip Hi, I was wondering why in mozilla firefox the same image menu has different way of transition on different sites. If you use firefox and go to this link and then hover over different pictures you will get to know how it moves http://www.alohatechsupport.net/exam...ge-menu-2.html after doing that go to this link http://bloghutsbeta.blogspot.com/201...ting-main.html and hover over images and see how it moves. In both cases the transition effect is same but in one it is slow (hanging) while in other it is smooth. I didn't presented the Markup as the both are identical but still if you feel like let me know in comments I will edit it to provide you with as much relevant data as possible and required. I was wondering if there are any sites dedicated to ending javascript objects using the prototype property to give them features like trimming string, removing elements of arrays by name, removing duplicates in arrays, etc. Granted I have functions to do this but there's probably a ton of other good ones out there. Most things I've seen are frameworks like JQuery (which is awesome) but it doesn't extend these objects.
We are building an opera extension in which we are trying to use the document object property (document.body.innerHTML) in order to obtain the source of the main page of a site. In most cases it provides us with the correct page source but for certain sites (ones that have multiple document layers), it doesn't return the top most document. For instance, for the site (https://www.pcisecuritystandards.org/) we would like to source for the main page that is displayed but once the entire page is loaded, the document property would display the source for another layer (https://s7.addthis.com/static/r07/sh...rev=86981&xd=1) This perhaps has to do with how opera loads the document layers in a page. We did not face any issue with any other browser How can we obtain the source of the main page (https://www.pcisecuritystandards.org/) using the document object in Opera ? |