toymachine22122
01-05-2004, 11:36 PM
I am trying to write a simple script that will allow people with a password to edit the web site from an in-site engine. Almost all of this has been already completed with CGI, but I need this one JavaScript for an HTML page. I am by no means experienced at javascript, and this is really my first javascript that is not just a modified version of someone else's script. Anyway, what I'm trying to make is a JavaScript command line, which will appear as a text box on an HTML page.
If someone types "Cascade" into the box and hits Enter, it should take them to the cascadeoptions.html page
If someone types "CACLS" into the box it should take them to caclmod.cgi
If neither of these are typed into the command line, it should take them to whatever page they type, with the extension of ".html"
In other words, if they type "redrose" in the command line it should take them to "redrose.html"
A good example of this is the GateKeeper script found on PageTutor.com by Joe Barta. You can take a look at that Here (http://www.pagetutor.com/keeper/index.html).
Here is a page containing solely the HTML tags and the script as i have it now. could someone please tell me what's wrong with it?
<HTML><HEAD><SCRIPT LANGUAGE="JavaScript"><!--
/****************************************
* Command Line Script, by Will Dresh (w.dresh@verizon.net)
* You are free to use this on your web site as long as this notice stays intact
****************************************/
function CMD() {
var CMDText = CMDLine();
if ( CMDText == "Cascade" ) { href = cascadeoptions.html; }
elseif ( CMDText == "CACLS" ) { href = cacls.cgi; }
else { this.location.href = CMDText + ".html" }
//--></SCRIPT></HEAD><BODY BGCOLOR="black" TEXT="limegreen"><FORM><INPUT TYPE="text" NAME="CMDLine"><INPUT TYPE="submit" VALUE="Enter" onClick="CMD() return false;"></FORM></BODY></HTML>
Thanks
If someone types "Cascade" into the box and hits Enter, it should take them to the cascadeoptions.html page
If someone types "CACLS" into the box it should take them to caclmod.cgi
If neither of these are typed into the command line, it should take them to whatever page they type, with the extension of ".html"
In other words, if they type "redrose" in the command line it should take them to "redrose.html"
A good example of this is the GateKeeper script found on PageTutor.com by Joe Barta. You can take a look at that Here (http://www.pagetutor.com/keeper/index.html).
Here is a page containing solely the HTML tags and the script as i have it now. could someone please tell me what's wrong with it?
<HTML><HEAD><SCRIPT LANGUAGE="JavaScript"><!--
/****************************************
* Command Line Script, by Will Dresh (w.dresh@verizon.net)
* You are free to use this on your web site as long as this notice stays intact
****************************************/
function CMD() {
var CMDText = CMDLine();
if ( CMDText == "Cascade" ) { href = cascadeoptions.html; }
elseif ( CMDText == "CACLS" ) { href = cacls.cgi; }
else { this.location.href = CMDText + ".html" }
//--></SCRIPT></HEAD><BODY BGCOLOR="black" TEXT="limegreen"><FORM><INPUT TYPE="text" NAME="CMDLine"><INPUT TYPE="submit" VALUE="Enter" onClick="CMD() return false;"></FORM></BODY></HTML>
Thanks