JavaScript - How Would I Reference A Flash Form Text Area From Within Javascript?
I am running some javascript code which generates a popup window associated with a spell checking program. The way the program works, is that it takes the text out of a text field (passed as an object), spell checks the string, then puts it back into the text area field.
My text area is located within a flash form, and I am having trouble pointing to it. I am sure my spell checking program is working, as it works fine if I point to an html text area. Do I have to do something special to point to a flash form object? Here is my code: Code: <!--- Source the JavaScript spellChecker object ---> <script language="javascript" type="text/javascript" src="../Spellchecking/spellerpages-0.5.1/speller/spellChecker.js"> </script> <!--- Call a function like this to handle the spell check command ---> <script language="javascript" type="text/javascript"> function openSpellChecker() { // get the textarea we're going to check <!--- pointer to text area ---> var txt = window.activity.Summary; // give the spellChecker object a reference to our textarea // pass any number of text objects as arguments to the constructor: var speller = new spellChecker( txt ); // kick it off speller.openChecker(); } </script> Also, here is my text area: Code: <cfform format="flash" id="activity1" height="#formheight#" width="100%" style="#formstyle#" timeout="3600" wmode="transparent" name="activity" onLoad="#initVars#; onFormLoad();"> <cftextarea name="Summary" id="Summary" html="yes" maxlength="1000" tooltip="Summarize your entry here. The field has a 1000 character limit. This summary is included in the generated End of the Week reports." onChange="submitTemporary('Summary', Summary.text);requiredContent('summary');" onFocus="if(detailsBox.height>60){detailsBox.height=60;summaryBox.height=220;}"></cftextarea> </cfform> Any help on this issue would be much appreciated. Thanks, AeroNicko Similar TutorialsAs of right now I have a code that will work in IE but wont work in FireFox...go figure. Basically what I want to have happen is when you type in an area code it will provide an output in a predetermined area of the page. For Example: Input- 512 Output - Austin, TX The code that I have doesn't work with firefox and I was just wondering if there was a code that would allow that to happen. Thanks! Hello, I have 2 things I'm trying to figure out. 1. First form on the page has questions with radio buttons. Each radio's value is a number so a score is assessed at the end. 2. Second form on the page is an email the admin form, which duplicates the score in one field. Question: I would like to know how to write the form results to a text area in second form. However, I can't do this for one, and secondly, the value is a number, can I use labels? Here's the code I've 'made up' so far... JS (i know it's wrong) Code: <script LANGUAGE="JavaScript" type="text/javascript"> function display() { message = "<ul><li><b>Question 1: </b>" + document.quizform.Q1.label; message = "<li><b>Question 2: </b>" + document.quizform.Q2.label; message = "<li><b>Question 3: </b>" + document.quizform.Q3.label; message = "<li><b>Question 4: </b>" + document.quizform.Q4.label; message = "<li><b>Question 5: </b>" + document.quizform.Q5.label; message = "<li><b>Question 6: </b>" + document.quizform.Q6.label + "</ul>"; document.write(message); } </script> Form field example: Code: Question 1:<BR> <label for="Yes"><input type="radio" name="Q1" value="0" checked></label>Yes<br> <label for="No"><input type="radio" name="Q1" value="10"></label>No<br> <label for="I don't know"><input type="radio" name="Q1" value="10"></label>I don't know<br> I'll admit I'm new to javascript, so my apologies if this looks like crap. Code: Taken out due to fix I'm trying to get this javascript to return a level to this form field. Code: taken out, due to fix Hi, I'm a student learning web design and having a problem with some javascript code, I'm validating a text area, i dont have a problem limiting how many characters can be typed in the textarea, but I cant get it to give an error if there is no text in the text area. In the code below the validateMes() function is not working, the other functions work fine Javascript code: Code: function validateLimit(fld){ var error =""; if(fld.value.length > 300){ error = "Cannot exceed 300 characters.\n" fld.style.background = 'Yellow'; }else{ fld.style.background = 'White'; } return error; } function validateMes(fld) { //this function not working var error = ""; if (fld.value.length == 0) { fld.style.background = 'Yellow'; error = "The Message field has not been filled in.\n" } else { fld.style.background = 'White'; } return error; } function validateFormOnSubmit(form1) { //master validating function var reason = ""; reason += validateLimit(form1.mess); reason += validateMes(form1.mess); if (reason != "") { alert("Some fields need correction:\n" + reason); return false; }else{ alert("Message has been submitted"); return true; } } Html form code: Code: <form name="form1" id="form1" onsubmit="return validateFormOnSubmit(this)" > <div class="box"> <h1>CONTACT FORM :</h1> <label> <span>Full name</span> <input type="text" class="input_text" name="name" id="name" value=""/> </label> <label> <span>Email</span> <input type="text" class="input_text" name="emailbox" id="emailbox" value=""/> </label> <label> <span>Subject</span> <input type="text" class="input_text" name="subject" id="subject" value=""/> </label> <label> <span>Message</span> <textarea class="message" name="mess" id="mess" ></textarea> <span>*Message limited to 300 characters</span> <input type="submit" class="button" value="Submit Form" /> </label> </div> </form> I can't see what I'm doing wrong, would really appreciate some help Thanks Hi Friends, I need a copy to clipboard functionality from a text area using javascript. I use Zclip for the purpose, but it will not work as needed . I attach my working code along with this .. pls open index.html in browser and try it . Do any one can pls give a javascript solution to copy textarea content to clipboard... Thanks, Anes Hello all I'm working on a simple feedback form (well not so simple for me) for the last page of my site. In the text area I expect to get normal western text PLUS (or even just) Chinese xharacters my question is how do you validate Chinese character input? low tech Hi, I have a form in which I preset some text inside a readonly, disabled textarea using javascript ('data' being the text): document.getElementById("link_of_current_view2").value = data; However, once I call my .php script to process the form, the element is null. How do I get it to pass along that data, which is in the textbox when the user views the form? Code: <div id="sendlink" class="contact_form" style="z-index:10;"> <a class="close" onclick="document.sendlink_form.reset();return false">CLOSE</a> <form id='sendlink_form' name='sendlink_form' method="post" action="sendlink.php" > <label for="link_of_current_view2">Link: </label> <textarea id="link_of_current_view2" name="_of_current_view2" class="link_of_current_view" rows="2" disabled="disabled" wrap="soft" size="58" value="" readonly="readonly" value=/></textarea> <input type="image" src="images/forms/submit.png" value="Submit" alt="Submit"> <a onclick="javascript:reset_sendlink()" style="cursor:pointer"><img src="images/forms/reset.png"></a> </div> Thanks for reading! Hi, I have a form setup so that selecting a radio button opens a specific text field. The problem is if the user starts to enter information, then switches to a different radio button (perhaps they chose the wrong radio to start), the text they already started to enter on the previous textfield doesn't get cleared. This will be a problem later when inserting to sql. Here is a summary of the code: Code: <head> <script type="text/javascript"> function doClick(objRad){ if (objRad.value=="0"){ document.getElementById("textbox").style.display='block'; } else{ document.getElementById("textbox").style.display='none'; } if (objRad.value=="1"){ document.getElementById("textbox1").style.display='block'; } else{ document.getElementById("textbox1").style.display='none'; } if (objRad.value=="2"){ document.getElementById("textbox2").style.display='block'; } else{ document.getElementById("textbox2").style.display='none'; } } </script> </head> <body> <form action="insert.php" method="post"> <p>Please choose the business type: <input type="radio" name="rad" value="0" onclick="doClick(this)"> Sole Proprietorship <input type="radio" name="rad" value="1" onclick="doClick(this)"> Partnership <input type="radio" name="rad" value="2" onclick="doClick(this)"> Corporation <div id="textbox" style="display:none"> <input type="text" name="txt"> This is my sole proprietorship info.</div> <div id="textbox1" style="display:none"> <input type="text" name="txt"> This is my partnership info.</div> <div id="textbox2" style="display:none"> <input type="text" name="txt">This is my corporation info. </div> </form> </body> Any help is appreciated, Thanks in advance! Hi I'm trying to write a data checking function that after it completes should return the focus to the text box that was checked and highlight everything in it IF the value was unacceptable. Here is the function: Code: <script type="text/javascript"> function chkValidity(numToCheck) { if (isNaN(numToCheck) == true || numToCheck < 0) { alert("Please enter a number greater than zero"); numToCheck.focus() numToCheck.select() return false } } </script> And here are the lines of code that would call the function: Code: <input type="text" name="numBedrooms" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaBedrooms" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="numLivAreas" size="2" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaLivAreas" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="numServAreas" size="2" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaServArea" size="3" maxlength="3" onblur="return chkValidity(this)" /> What I find happens is that the data checking works and the error mesage displays, but the focus does not return to the text box. Any ideas? Regards Jenny I've been looking for a reference to my situation for two days and i can't find any that are relevant enough. I'm trying to accept text as a URL for an image source. I then display that image in a form with the use of a <button type=button onclick=codeThatGeneratesImage > type thing. Code: function addImageToForm(formID) { //get a reference to the form var formElement = document.getElementById(formID); //get a reference to the element that contains the url var elementWithImageURL = document.getElementbyId("imageURLInput"); //get URL entered var imageURL = elementWithImageURL.getAttribute("value"); //create image element ---------------------------------------------------------------------------------- var newImage = document.createElement("img"); //reference the source using the url newImage.setAttribute("src", imageURL); newImage.setAttribute("name", "newImage"); //append the image to form formElement.appendChild(newImage); } i know that the bottom half works because i tried it with just a reference to an image directly and it worked. i can't figure out why most of the top part isnt working. any help would be much appreciated im clueless when it comes to javascript, but this is what im trying to find: i have a page that has multiple text areas, i also have 4 links that when clicked i want to add some predefined text into the active text area the one with the text cursor in? The Hyperlinks: Code: <a href="#sc">Shift Changed</a> | <a href="#ol">On Leave</a> | <a href="#ot">OverTime</a> | <a href="#ss">ShiftSwap</a> The textareas: PHP Code: <td><textarea name=details$i rows=4 align=absmiddle cols=16 value="$details[$i]\">$details[$i]</textarea></td> as you can see the textareas are created on the fly based on a php array. would anyone be willing to put some code together for this? or even give me the basics on how i can get the active textarea's name so i can pass that to a script that inserts into a given field? hey im new to javascript and im working in this function , i can't get it work here is my code PHP Code: <SCRIPT LANGUAGE="JavaScript"> function text(form1) { var j = document.form1.diary.value; j = j.italics(); document.form1.diary.value = j ; } </SCRIPT> whats the problem ? Hi, I am wanting to insert text into a text area when a button or link is clicked. I know how to replace the whole lot in the text area, but I want it to insert text where the flashing cursor is in the text box. (Like Wikipedia) If any one can help, Then I will be very, very greatfull. Thank You. Hi everyone, Does anybody know where I can download a decent Javascript reference in eBook format ?? I'm working on this website and some contents are set up in arrays. How do you refer variables to work with arrays. I need the correct syntax.
I just started learning javascript, and it'd be cool if I could find some kind of javascript reference site similar to php.net/manual with a quick reference search. After looking through google for a long while, all I could find was tutorial sites or reference books with the only way to navigate them is through boring tables of contents. Does such a place exist? Or what's the next best thing?
İ want to use this code but when the page opens, I get a null reference error. When I open the page a second time, this error doesn't occur. I understand when the site caches, this error doesn't occur. The error comes from tb_show function. My code: <script type="text/javascript"> function writeCookie(CookieAdi) { var dtGun = 1 var strValue = "1" if (dtGun == null || dtGun == "") dtGun = 365; var d = new Date(); d.setTime(d.getTime() + (dtGun * 24 * 60 * 60 * 1000)); var zt = "; expires=" + d.toGMTString(); document.cookie = CookieAdi + "=" + strValue + zt + "; path=/"; } function readCookie(cookieadi) { var c = document.cookie; if (c.indexOf(cookieadi) != -1) { s1 = c.indexOf("=", c.indexOf(cookieadi)) + 1; s2 = c.indexOf(";", s1); if (s2 == -1) s2 = c.length; strValue = c.substring(s1, s2); return strValue; } } writeCookie('OnerFacebook'); if (readCookie('OnerFacebook') != 1) { tb_show('', 'http://www.mobilyala.com/OnerFacebook/?KeepThis=true&TB_iframe=true&height=500&width=300&modal=true', ''); } </script> What should I do for it? So I'm working with a code that I can't seem to get the translation to show up in the text area. The user is supposed to enter text in a text area on the left hand side, hit the translation button, and the translation will appear like a sentence in the right hand text area. I don't seem to be able to get anything to show up in the right hand text area........ I know that i'ts probably something very simple that I am not seeing because at this point I am brain dead. Code: phrases = [["hello","ahoy"],["pardon me","aaarrgghh"],["excuse me","aarrr"], ["hows it going","hows it goin"],["sir","matey"],["madam","proud beauty"], ["woman","beauty"],["children","sprogs"],["where is","whar be"], ["can you help me find","know ye"], ["is that","be that"],["how far is it to?","how many leagues to"], ["the","th'"],["my","me"],["your","yer"],["there","thar"], ["outstanding","outstandin"],["attractive","attractive"],["happy","horny"], ["dead","went t' Davy Jones' locker"],["restroom","head"],["restaurant","galley"], ["hotel","fleabag inn"],["pub","pub"],["I would like to","I be needin' t"], ["I desire","I desire"],["I wish I knew how to","I'm a hankerin' t"], ["my mother told me to","MeAhoy! ol' mum, bless her black soul, always tol' me t"], ["have a great dinner","have a great what crawled out o' t' bung hole"], ["have a cocktail","swill a pint or two o' grog"],["fall on the ground","fall on t' ground"], ["get drunk","get splice t' mainbrace"]]; function Translate(text) { for(var i = 0; i < phrases.length; i++) { var toReplace = new RegExp("\\b"+ phrases[i][0]+"\\b", "i"); var index = text.search(toReplace); while(index != -1) { text = text.replace(toReplace, phrases[i][1]); index = text.search(toReplace); } } return text; } Code: <div> <textarea id="first_text" style="float:left" id="task_list" rows="20" cols="53"></textarea> <button id="translated" width="50px" heigth="100px" ><img src="pirate2.gif" />Translation----></button> <textarea id="second_text" style="float:right" id="task_list" rows="20" cols="53"></textarea> </div> HI to all I am new be and not able to resolve the issue when i tries to edit text area everything works fine for crome and ie but does not work for firefox in fire fox when i try to edit intially everythings works fine but if i click other feild in form and after that try to edit text area backspace key stuck up and does not work please help me ?? code which i am using is menitoned below function stopPropagation(e) { e = e||event; /* get IE event ( not passed ) */ e.stopPropagation? e.stopPropagation() : e.cancelBubble = true; } function checkShortcut(e) { stopPropagation(e); if({8:1,13:1}[e.keycode||e.which]) { if( x ) return true; return false; } } Dear all, Can anyone help me with this… I do not know if this is possible to be done… Instead of text: "Your favorite color is <b>Green</b> right?" I need to show form like this: Code: <form action="auto.htm" method="get" > Your state<br> <select name="statecode" id="statecode"> <option value="">Choose State...</option> <option value="AK">Alaska</option> <option value="AL">Alabama</option> <option value="AR">Arkansas</option> </select> <input type="submit" name="search" value="Get Quotes" /> </form> Thank you in advance This is code I wish to modify. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> html,body { padding:0; height:100%; } #right { width:500px; height:100%; background-color:#999; text-align:center; float:right; } #left { height:100%; margin-right:500px; background-color:#f00; text-align:center; } </style> <script type="text/javascript"> function change() { switch (document.getElementById("select").value) { case "1": document.getElementById("change").innerHTML = "Your favorite color is <b>Green</b> right?" break; case "2": document.getElementById("change").innerHTML = "Your favorite color is <b>Red</b> right?" break; case "3": document.getElementById("change").innerHTML = "Your favorite color is <b>Yellow</b> right?" break; } } </script> </head> <body> What is your favorite color <select onchange="change()" id="select"> <option value="">------</option> <option value="1">Green</option> <option value="2">Red</option> <option value="3">Yellow</option> </select> <div id="change" style="margin:10px;width:200px;height:100px;padding:5px;"> Original Text </div> </body> </html> |