Jump to content

Creating a Guestbook in js


johna100

Recommended Posts

Alright, someday i want to be able to make a Forum in JS but right now im starting w/ the basics i want to know how to create a simple guestbook in JS (no online editors, I want to know with pure code). This guestbook i want to have a name box, a message box and a submit button. I also want to have all the posts displayed below. Can anyone help me?

Link to comment
Share on other sites

To make such a script, you would have to use the help of AJAX and PHP/ASP. There's no possible way to just do the whole thing with javascript.

Link to comment
Share on other sites

alright now i understand how to do it better but Can some one explain in detail how to do it. If you could please post.

Link to comment
Share on other sites

Here is something in javascript to load a file and store it in a variable, after which you can do whatever you want with it. I don't know about the writing though. (this was revised from dynamicdrive.com's ajax include)

<script type="text/javascript">/************************************************ Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit Dynamic Drive at [url="http://www.dynamicdrive.com/"]http://www.dynamicdrive.com/[/url] for full source code***********************************************///To include a page, invoke ajaxinclude("afile.htm") in the BODY of page//Included file MUST be from the same domain as the page displaying it.var rootdomain="http://"+window.location.hostnamefunction ajaxinclude(url) {var page_request = falseif (window.XMLHttpRequest) // if Mozilla, Safari etcpage_request = new XMLHttpRequest()else if (window.ActiveXObject){ // if IEtry {page_request = new ActiveXObject("Msxml2.XMLHTTP")} catch (e){try{page_request = new ActiveXObject("Microsoft.XMLHTTP")}catch (e){}}}elsereturn falsepage_request.open('GET', url, false) //get page synchronously page_request.send(null)content=writecontent(page_request)return content;}function writecontent(page_request){if (window.location.href.indexOf("http")==-1 || page_request.status==200)return(page_request.responseText);}</script>

Link to comment
Share on other sites

Thanks you guys, this is gonna make it so much eayer to create my own now that i have some examples. This is so ausome!!!!!!!!!.....yup...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...