JavaScript - Get Tinymce Value To Url With Javascript
Hello I'm trying to get the values from the TinyMCE with a javascript in to the url but it's not working, can any one help me?
The script has been simplified to better understand mu problem, I can get all the rest of the form fields in to the url but not the textarea, it's a bit stubborn. Code: <script language=JavaScript> function reload(form) { for(var i=0; i < form.adtype.length; i++){ if(form.adtype[i].checked) var v1=form.adtype[i].value; var v2=form.title.value ; var v3=form.price.value ; var v4=form.subcat.value ; var v5=form.description.value ; <!-- TinyMCE description Variable-->// } var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='new_ad.php?cat=' + val + '&adtype=' + v1 + '&title=' + v2 + '&price=' + v3 + '&subcat=' + v4 + '&description=' + v5; } </script> <?php $Description=$_GET['description']; echo "<label for=\"cdescription\">Description (required) </label> <textarea id=\"elm1\" class=\"required\" name=\"description\" maxlength=\"1000\" rows=\"\" cols=\"\">$Description</textarea>"; <label>Want <input type=\"radio\" name=\"adtype\" value=\"want\" onclick=\"reload(this.form)\" /></label> ?> Similar TutorialsHi I have a CMS system using Tinymce and after making some alterations noticed the updates weren't showing up. After much messing (sql, set up etc) I started to delete the content bits at a time and came to the conclusion that is was the character ' as in what's any ideas why this is and how to solve it i'm thinking its due to php code! Cheers I integrate TinyMCE with a web application. After plugging in TinyMCE, a textarea shows up on a place where no textarea is defined. So far, this problem happens on a web page with multiple textareas. It seems to be caused by either <fieldset> tag or a <TEXTAREA .. readonly>. A non-defined textarea shows on the top of these elements. Does anyone else run into the same problem? Thanks. HI I'm new to tinymce. I'm using tinymce with jquery validate with remote Methods. (Remote Methods: http://docs.jquery.com/Plugins/Valid...Methods/remote) I'm using jquery validate to check if email address already has been enter into the database, once it check the email hasn't been entered. It then enter the email with the tinymce textarea. Right now the email address gets enter but tinymce textarea is undefined. I understand I have to uses the var content = tinyMCE.get (editor_id);, but its still enter as undefined, here is my code below: Code: <html> <head> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.validate.js"></script> <script type="text/javascript" src="js/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // Location of TinyMCE script // General options mode : "textareas", elements : "editor_id", theme : "advanced", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, content_css : "css/content.css", }); <script type="text/javascript"> $(document).ready(function(){ var validator = $("#myform").validate({ rules: { email: { required: true, minlength: 5, remote: { url: "test.php", type: "post", data: { dataType: 'json', email: function() { return $("#email").val(); }, content: function() { return $("content").val(); } }, }, } }, messages: { sub_name: { required: "Please enter a email address", minlength: "Your email addressmust be at least 5 characters long", remote: jQuery.format("Sorry but '{0}' has already been added. Please try again.") } }); }); </script> </head> <body> <form id="myform" action="" method="post"> <input type="text" name="email" id="email" size="15"/> <textarea id="editor_id" name="editor_id" rows="15" cols="80" ></textarea> <input type="submit" value="Submit"/> </form> Where do I added? Code: var content = tinyMCE.get('editor_id'); content = escape(content.getContent()); content = content.replace("+", "%2B"); content = content.replace("/", "%2F"); thanks Hi all, After over a month of pounding my head against the wall (and getting ZERO help from the TinyMCE "support" forum), I have finally come up with a simple JS function (for the TinyMCE editor) that will wrap a selection with any open and any close tag one wishes, and keeps the selected text selected for further wrapping if desired. Here's the code (commented heavily): Code: /* -------- FOR TINYMCE ONLY -------- * wrap selection with BBCode or other tags * (c) 2010 r.a.krupski <krupski@roadrunner.com> * free software - use, modify, distribute freely ** -------- FOR TINYMCE ONLY --------*/ function tinyWrap(open_tag, close_tag) { var ed = (tinymce.activeEditor || opener.tinymce.activeEditor); /* get editor instance */ var selection = ed.selection.getContent(); /* get user selection, if any */ var temp_name = new Date().getTime().toString(36).toLowerCase(); /* generate a unique string */ var span_open = '<span id="' + temp_name + '">'; /* generate '<span id="unique">' */ var span_close = '</span>'; /* generate closing '</span>' */ selection = selection.replace(/<p>/g,'').replace(/<\/p>/g,'<br />'); /* convert <p></p> to <br /> */ if (selection.substr(selection.length-6) === '<br />') { selection = selection.substr(0, selection.length-6); /* strip last <br /> if present */ } /* create complete selection replacement: '<span id="unique">OPEN_TAGselectionCLOSE_TAG</span>' */ var content = open_tag + span_open + selection + span_close + close_tag; ed.execCommand('mceReplaceContent', false, content); /* replace selection with new */ var span_elem = ed.dom.get(temp_name); /* get the element of the temp span */ ed.selection.select(span_elem); /* select (highlight) the selection span */ ed.dom.remove(temp_name, true); /* remove the span, leave it's highlighted text behind(true) */ ed.focus(); /* insure editor has focus */ return; /* taa-daa! all done! */ } Hope this helps someone - I've got a few more gray hairs because of TinyMCE... hopefully this will spare others my agony...... -- Roger I want to have another go at Javascript. I have several books on the subject but I find that my eyesight is a major problem. Therefore I want to try an on-line solution, preferably free. I have Googled, but there are so many that I am almost dizzy with the choices. Perhaps someone could recommend one. Not too fussy visually. My knowledge is VERY basic. Frank Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... Hey, I've got to make the values of some textboxes change the co-ordinates of my sprite on a canvas and havent a clue on how to do it, Here is my form with the two textboxes and submit button: <form> x: <input type="text" name="x" /><br /> y: <input type="text" name:"y" /><br /> <input type="submit" value="Submit"/><br /> </form> And i need it so that they change the values of these: //this shows where my sprite will start on the canvas var block_x; var block_y; searched the internet for hours and cant really find anything i understand or works. any help is much appreciated I want to insert this js snippet Code: function addText(smiley) { document.getElementById('message').value += " " + smiley + " "; document.getElementById('message').focus(); return false; } to a loaded iframe with name&id chtifrm. I can access it & change embed something in its html via using something like: Code: $(parent.chtifrm.document.body).append('<div id=\"smly\" style=\"cursor:pointer;float:left;top:200px;display:none;position:absolute;\"><\/div>'); .... Code: parent.chtifrm.document.getElementById('chatbox_option_disco').style.display == 'none' but how do I insert js in the head of loaded iframe? Hi Guys I am trying to modify the functionality of my page. I want to be able to activate this piece of code using another javascript function. This is the code I want to activate: Code: <script type="text/javascript"><!-- $('#button-cart').bind('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea, .date_data input[type=\'text\']'), dataType: 'json', success: function(json) { $('.success, .warning, .attention, information, .error').remove(); if (json['error']) { if (json['error']['warning']) { $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>'); } } if (json['success']) { $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart_total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }); //--></script> And this is how I want the format of the function to be: function testsession() { if there is a session called 'hiredate' { activate the script above } else { var el = document.getElementById("product_data"); } } I just dont know how to write this in javascript Could you help me if possible please All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero I wrote a log function that took note of various function calls. Thinking that functions are first class objects, and objects have properties, I made the name of each logged function a property of that function, e.g., brightenInnerPara.name = "brightenInnerPara"; Every browser I tried (Firefox, MSIE, Opera, Chrome, Safari) accepted the assignment, no problem. In Firefox and MSIE, the result was what I wanted: brightenInnerPara.name == "brightenInnerPara" But in the others, the result was: brightenInnerPara.name == null Question 1. Which Javascript is correct here? I favor Firefox and MSIE, not merely because they were willing to give me what I wanted, but also because it makes no sense to accept an assignment statement without throwing an error and then give it a null semantics, like Chrome, Opera, and Safari did. I found a workaround, using assignments like this: brightenInnerPara.prototype.name = "brightenInnerPara"; To my surprise, that worked in every browser. But I don't know why. It seems that such assignments are enough to cause each function to have its own distinct prototype. Question 2. Just how inefficient is my workaround, and why does it work? I designed a simple mobile in html , i want to link it to strings such that.... example : there are numbers from 0 to 9 and when ever i click on a number and then click on another after all the click i made and at last when i click on the " dial" (for example purpose) it should prompt all the numbers in sequence where i click. example to make it clear for my purpose : 1 2 3 4 5 6 7 8 9 * 0 # Dial (button) I clicked on "4" then "6" then "9" and then i hit the "dial" button the it shold show an alert box displaying "469" . I think it isn't a big challenge for you javascript coders. Please post the whole javascript code for this function, also the id's defined to the html separetly by you I am just learning and up on queries , so want your help Thaks a ton I am really struggling to do something really painfully simple he just create a class in javascript!! I tried this, based on a google search: Code: function myclass() { this.myvar = 1; this.mymethod = function() { alert(this.myvar); } } But, of course, this.myvar in mymethod is not the same as this.myvar in myclass. So I did another google search, and tried this: Code: function myclass() { this.myvar = 1; this.prototype.mymethod = function() { alert(this.myvar); } } And I get the error report: "this.prototype is undefined". So I tried parent and super in place of this within mymethod, but both of those throw up an "<whateve> is undefined" error too. I give up!! Is it just me, or is trying to write OO Javascript really like trying to grapple with a slippery fish?!! Something that should be really painfully simple is proving to be a nightmare ... Sir i have a problem that, in head tag i have a easyslider script that working well, now i want to add new script of lightbox for image viewing but it does not working, when i remove the slider script files then lightbox working properly but when i add slider scripts files then lightbox not working, may be some function have same names or may be other problem i do not know. plz help me This is my javascript: <script type=text/javascript> function alert(){var value=1; alert("value");} </script> <?php Some Code.... ?> Now i want to convert "var value" in to php variable in my php script on the same page. How can i do it? |