Question:
webpage with javascript alone?
arjunprasadyadav
2011-01-29 01:55:26 UTC
One of my friend tell me that it is possible to create a whole Web-site only with the help of Java-script.

Is it Possible?
Please Advice
Three answers:
Emissary
2011-01-29 04:29:30 UTC
Well it depends how much functionality you want, if you mean can you just use Javascript and HTML - yes you can but you will struggle with user-specific content and content-management as there isn't a secure way to access a database with JS alone.



If you mean, can you build an entire page from within a script as other users seem to have interpreted your question then that is also entirely possible. I've found building a DHTML page entirely with javascript quite useful for specific offline browser-based applications.



If this is what you were asking I'd suggest using document.write(); to include the doctype, and the html, head, title, and body tags for continuity. And placing a
with an id inside the body tags to serve as a container from which all subsequent elements can be located. I've included a simple example below - see link at bottom if Y!A truncates the code. Also note that you could reference an external style sheet in the header information to make the code look cleaner - and rather than changing individual styling you can set: someElement.className = "";





?
2011-01-29 10:36:10 UTC
Or your friend lied to you, or he/she is a newbie too! Html is the basic language for building websites. It's the skeleton of the website. You can't -CAN'T- build a site without html! On a top-5 order of importance of what you need the scale goes like this:



1 = More important, 5 less important

HTML = No1

CSS = No2

PHP and usually MySql = No3

Javascript = no4 = IF you actually need it
anonymous
2011-01-29 10:02:34 UTC
yes but you have to still write it in html like so

and I think you actually have to put the tag and possibly the head and body tag outside of it





document.write("

this is a paragraph

");


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...