JavaScript - Comment Posting Feature In My Site
I am trying to create a comments posting feature in my site using javascript
However everytime i click on submit it shows the comment posted for a second and then the comment dissapears. It does not retain the comment posted. Please help. code is given below: Code: <html> <head> <script type="text/javascript"> function post(){ document.getElementById("label").innerHTML=document.hello.posted.value; } </script> </head> <body> <form name="hello"> <div id="label"> </div> <textarea name="posted"> </textarea> <input type="submit" value="Submit" onclick="post()"> </form> </body> </html> Similar TutorialsThe DOD has a method of letting you know how much BAH you are entitled to based on your zip code and pay grade. They have a "tool" that tells you what you get.... how do i get that "tool" on my site so i can stop linking people off my site? the feature i want is on https://www.defensetravel.dod.mil/site/bahCalc.cfm my BAH page is on: http://www.bootcamp4me.com/basic-all...r-housing-bah/ I dont even know how to get this tool on my site... any ideas on how to do this for my wordpress site? Hi all, I want to find a Javascript if possible that emmulates the fuctionality shown under Editor's choice on either of these sites. http://www.irishtimes.com www.cnn.com I won't be using video but I would like the user to be able to click on a Left or Right arrow and upon doing this a new batch of Images with associated URL links will slide in. Problem I have is that I do not know what I should search for. Have tried keywords such as "Image Link Scroller", "Slideshow" but have not found a script that does something like what is on these websites. Any ideas? Hi everyone, I currently have a slideshow working on my client's site, but I can't get lightbox to work properly on it. [bobbivanstudio.com/work.php] Is there a way to fix the existing slideshow to work with lightbox? Or is there another way of doing this (keeping the same look that is currently in place)? Thanks in advance! I forgot to append what key is actually pressed too, but not sure how? Any quick help would be appreciated. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang=en> <head> <title>Question 5</title> </head> <body> <form> Char: <input type="text" id="catch"/> <br /><br /> Keycode: <br /><textarea id="display"></textarea> </form> <script type="text/javascript"> var ip=document.getElementById("catch") ip.onkeypress=function(a) { var a=window.event || a var uc=a.charCode || a.keyCode document.getElementById("display").value=uc } </script> </body> </html> Hey all - trying to find a good rotating box with SEO content. Like this one, do you know what they are using or how I can accomplish this with something similar? http://www.studioscentral.com/ Thanks in advance Hi, I have been developing a show/hide feature on my companies web site for some time. I have so much code as to where I am confused when I need to add another slide function. I have provided the URL below to the page where the code exists. http://www.pjm.com/markets-and-opera...assistant.aspx This is where I get lost with the huge amount of code that I have. If you take a look under the second slider named "Electricity Markets" there is another slider underneath named "Energy Market". I need to add three more sliders right underneath in the same format under "Energy Market" If anyone can assists with this that would be great. I should have organized the code a lot better, so now I get lost within the code now. BTW, the show/hide feature really does not display well in Firefox, please try in IE. Thanks! Hello, http://www.phoenixdigitalweb.com/Con...urecommercial/ The main image is actually 1087 pixels wide. I want all the photos to appear 1087 pixels wide, but there is some code that is resizing the images. Can someone please take a look for me? Let me know if any code is needed. Thanks!! Several of the iPhone features can be duplicated with Javascript. One such feature I'd like to see is the Bookmark feature. You click on the Bookmark or Favorite button and the page name (of the html page) is saved to a list, just like what you see in modern browsers. Clicking on the list row brings up the bookmarked page. However, the app is not a browser, but made up of html/css/js pages that function from within a /www/ folder of the app. I've searched for such a script online, but the only ones I see are for desktop browsers (they permit a visitor to click on a link to place the page in the Bookmarks tab or folder of the browser). Does anyone know of a script that'll work on html pages in the iPhone and Android devices? Thanks! Steve Hello JavaScripters! I was hoping you could help me with an application I'm working on using C# and the .NET Framework that incorporates Javascript. I'm trying to do something similar to to the FireBug / Firefox Inspect Element featu I came across http://www.selectorgadget.com/ which is exactly what I'm trying to do. It's in Javascript and after looking through the source code for the past 2 hours I still don't have a clue how to incorporate it into my program... From what I can tell it uses tokenizing and recursive analysis of DOM elements to figure out CSS selector paths: http://www.selectorgadget.com/stable/lib/dom.js. Here is what I have so far. The javascript code highlights HTML elements such as a <table> tag and changes the border and background color. Code: document.onmouseover = dohighlight; document.onmouseout = dohighlightoff; var BGCOLOR = "#444444"; var BORDERCOLOR = "#FF0000"; // Highlight <table> in grey function dohighlight() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==0) { elem.border = 1; // store current values in custom tag attributes // elem.oldcolor = elem.style.backgroundColor; // store backgroundcolor elem.style.backgroundColor = BGCOLOR; // new background color elem.oldbordercolor = elem.style.borderColor; // same with bordercolor elem.style.borderColor = BORDERCOLOR; var rng = document.body.createTextRange(); rng.moveToElementText(elem); // Make a red border around <table> function dohighlightoff() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==1) { elem.border = 0; // recover values from custom tag attribute values elem.style.backgroundColor = elem.oldcolor; elem.style.borderColor = elem.oldbordercolor; } } Any ideas on how to incorporate the Selectorgadget into my program would be greatly appreciated! Selectorgadget Source Code: https://github.com/iterationlabs/selectorgadget Hello, well i am having this annoying issue from previous 3 months and its a very long story to tell but i will try to make it small, well i am interested in using a popup to show flash games in it, so i did then my interest went to make all games playable in full screen so i did that too and got success, but i am facing issues due to wmode, if you visit my this site link http://www.bloghuts.com/2010/11/13-days-in-hell.html and click on play game for other browsers while using google chrome browser, you will see the error there will be blocks appearing in the game, while if click on play for google chrome then this error is not there, its just because of WMODE, for google chrome button i am using wmode while for all other browsers i am not doing this. the reason for not using wmode to my other browser play button is that if i add wmode to the games then the performance of the game is highly damaged in fireforx and internet explorer, and also to some extent in other browsers including google chrome. WHAT DO I NEED FROM YOU PEOPLE? it is that i want to get rid of this wmode=opaque thing as it makes the game slow even in google chrome which is effecting game playing quality, i used window,transparent too but nothing good came out of it. Only google chrome is asking for the wmode, while our step child internet explorer is happy with it, hehehehe Please someone help me out i am literally taking out my hair, lol some more information i would like to provide so that things work fast, i am using blogger blog, i have knowledge of html,xhtml,css, and for java or jquery its hint and trial. thanks for reading the long story and giving me time, if you can help please help me out, and i don't have money to pay for your service of help, otherwise why would i try to make blog xD. thank you Regards. Cryoffalcon. I have found a jQuery slide show at http://tobia.github.com/CrossSlide/ which interests me because of its smooth, cross-browser fade transitions. I would like to add a feature which automatically resizes the images proportionally, to fit the browser window. This feature is demonstrated in the Supersized slide show at www.mauitradewinds.com, but I am not satisfied with the quality of fade transition with Supersized -- especially under Safari. I would appreciate any guidance as to how to implement auto-resizing with the Cross-slide plug-in. Additionally, it would help if Cross-slide launched the slide show without waiting for all images to load.
what's the fastest or easiest way to get all comment nodes into an Array? the solution only needs to work in ie8/w3 if that helps. Hi, I'm mainly a PHP/HTML coder, but now I saw an excellent opportunity to use some Javascript. On my social network I'm adding the option to comment on statuses. What I need help with is how to this: I want it to be a text that says "Comment on status", when the user clicks this text I want the comment form to drop down under there and the "comment on status" link to disappear. Please help me with this, thank you in advance. Hi I am creating a help page on my website and I am putting a form on there in case users wish to leave any feedback/suggestions. Now, I am using JavaScript to try and solve this. What I want is a form box, which when the submit button is clicked, it creates a new div box underneath the form (or existing comment div) and updates the site this way. At first I would like to just get the functionality of the div being created and updated, then I will imrpove/add my form inputs etc. Here is what code I have so far: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>template</title> <meta name="description" content="Brief description of the page" /> <meta name="author" content="Thomas S. P. Vasey" /> <style type="text/css"> label {width: 7em; float: left; text-align: right; margin-right: 1em; margin-left: 1em; display: block; text-decoration: underline; font-family: century gothic; font-size: 10pt; font-weight: bold;} fieldset {background-color: gray; width: 50%; color: #f7852c; display: inline; border: 0pt;} legend {color: black; border: 1px solid #000000; font-size: 14pt; padding-left: 1em; padding-right: 1em;} textarea {border: 1pt solid black; background-color: #f7852c;} input {border: 1pt solid black;} input[type="text"] {background-color: #f7852c;} input[type="button"] {background-color: #f7852c; font-family: century gothic; border: 2px solid black; padding: 0.5%; margin: 2%;} input[type="reset"] {background-color: #f7852c; font-family: century gothic; padding: 0.5%; border: 2px solid black; margin: 2%;} input:focus {background-color: #80b7ff;} textarea:focus {background-color: #80b7ff;} </style> <script type="text/javascript"> function printOut() { var alias = document.form1.username.value; var comment = document.form1.comments.value; document.write('<div class="output">' + alias + '</div>'); document.write('<div class="output">' + comment + '</div>'); } </script> </head> <body> <form action="" name="form1" method=""> <fieldset> <legend>[A!B]Attitude Brothaz Feedback</legend> <p> <label for="username">Name/Alias:</label> <input type="text" name="username" maxlength="25" size="20" /> </p> <p> <label for="comments">Comments:</label> <textarea name="comments" rows="5" cols="40"></textarea> </p> <input type="button" value="Submit Post" onclick="printOut()" /> <input type="reset" value="Reset Form" /> </fieldset> </form> </body> </html> I hope someone can help me achieve this, I believe I am going in the right direction with it, just need some guidance. Thank you for your time, Regards, LC. I have concatenated list of posts, whereby a user can comment on each one (and the comment gets a live update via jquery). I decided that since I'm using a unique variable for each post, I could just tack that onto the end of the id of the update div, and also tack it onto the end of the class of the submit button, like so: PHP Code: $my_list .= ' <form action="#" method="post"> <textarea class="commentbox" name="comment" id="comment"></textarea> <input type="hidden" name="post_id" id="post_id" value=' . $post_id . ' /> <input type="hidden" name="member_id" id="member_id" value=' . $id . ' /> <input type="submit" class="submit' . $post_id . '" value="Comment " /> </form> ' . $comment_list . ' // existing comments queried from the db <ol id="update' . $post_id . '"></ol> // jquery-ed live update comments '; ?> Everything with respect to the above looks fine (i.e. each submit button gets a unique class and each update div gets a unique id). So the problem I'm running into now is: how do I get my js function to recognize each of the unique "submits"? This is what I have now (below). But whenever I click on a submit button next to a post, nothing happens, my page just reloads and a "#" gets added to the end of the url. I checked my live http headers, and it looks like the comment is getting posted along with the correct unique $post_id... but I believe it's stopping at the js function. Code: <head> <script type="text/javascript"> $(function() { $(".submit<?php echo $post_id; ?>").click(function() { var post_id = $("#post_id").val(); // this is the unique id for each story, in a hidden input var member_id = $("#member_id").val(); // this is a member for the commenter, in a hidden input var comment = $("#comment").val(); // this is the comment from the input box var dataString = 'post_id='+ post_id + '&member_id=' + member_id + '&comment=' + comment; if(comment=='') { alert('Please enter a valid comment'); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<span class="loading">Loading Comment...</span>'); $.ajax({ type: "POST", url: "commentajax.php", data: dataString, cache: false, success: function(html){ $("#update<?php echo $post_id; ?>").append(html); $("#update<?php echo $post_id; ?> li:last").fadeIn("slow"); document.getElementById('post_id').value=''; document.getElementById('member_id').value=''; document.getElementById('comment').value=''; $("#comment").focus(); $("#flash").hide(); } }); } return false; }); }); </script> </head> Hi, I'm trying to make a comment field that only appears once you've clicked the "Add comment link". I'd like it to replace the add comment link. I assume this is an onclick event of some sort, but I'm not sure quite how to go about doing it. Help would be highly appreciated. I came across some embedded JavaScript code and I noticed some weird “HTML comment-like tags” within embedded JavaScript that are getting rendered in FireFox but not IE. Specifically the closing tag "//-->" And the JavaScript code between these tags is functional (not commented out)! Code: <SCRIPT type=text/javascript> <!-- .... //--> </SCRIPT> What are these? Example usage: Code: <SCRIPT type=text/javascript> <!-- var zz, zv, d, fTSR; d = new Date(); fTSR=0; zv = d.getTime(); zz = "&zz="+zv; var gBF=false; function GoTo(u){window.top.location = u + zz;} function Go(u){window.top.location = u;} .... //--> </SCRIPT> Hello I'm not sure if I post this message on the right section or not...Actually what iam having difficulty at is I put a facebook plugin commentbox on my page. here is the link for my site http://www.mxstudio.ca/comments.html what my qestion is I can't delit other people message from this page. So if someone post badwords to my site is there anything I can remove his or her comments from this comment section. Any answer greatly precaite thanks... Hello I'm not sure if I post this message on the right section or not...Actually what iam having difficulty at is I put a facebook plugin commentbox on my page. here is the link for my site http://www.mxstudio.ca/comments.html what my qestion is I can't delit other people message from this page. So if someone post badwords to my site is there anything I can remove his or her comments from this comment section. Any answer greatly precaite thanks... |