Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Question upon pressing the [enter] key, the submit button isn't selected

    This is a problem that has been pestering me for a long time now.
    I have written a simple code in HTML which uses frames; basically, when you type in something in the text-box, if it

    recognizes it from the script it will take you to it's set page, and if it's doesn't, then it'll take you to another set page

    informing the user that it doesn't recognize your entry.
    It's like a ChatBot basically.

    What I need help with though is two things:
    1. my first issue is when you up on pressing the [Enter], or [Return] key it does nothing, and you instead have to click the

    'Submit' button; what I want is to be able to press the [Enter] key within the text-box and it automatically clicking that

    button for me (like a search engine or login page would, etc)

    2. And my second problem is that, when I load up my page; I want my cursor to automatically be set in the text-box, like with

    Google; so that as soon as you load up the page you can type something in, and it'll appear in the text-box automatically,

    without you having to click the textbox first.

    If you geniuses are able to solve this for me, I literally will love you forever. Haa ha
    I'm not kidding, I have been trying to figure this out for ages, so I wish you the best in cracking a method.
    Anyway, I would love to hear from you soon... All the best And a million thanks for reading/helping.

    ---

    There are two frames, and one index to link them both together.
    This is the 'header' frame, and all documents from this frame, shall be displayed in the 'main' frame.

    Here's a copy of my code:

    <html>
    <HEAD>

    <meta http-equiv="Content-Language" content="en-gb">

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function Login(){
    var done=0;
    var data=document.login.data.value;
    if (data=="8") { parent.main.window.location="8.html"; done=1; }
    if (done==0) { alert("Could you please rephrase that?"); }
    }
    // End -->
    </SCRIPT>

    <title>Header</title>
    <base target="_self">

    <BODY>

    <center>
    <form name=login>
    <table width=225 border=0 cellpadding=3 style="border-collapse: collapse" bordercolor="#111111" cellspacing="0">
    <tr><td>
    <p align="center"><input type=text name=data size="20"></td><td>
    <p align="center"><input type=button value="Submit" onClick="Login()"></td></tr>
    </table>
    </form>
    </center>


    </html>

  • #2
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    1) Never use onclick for a submit button when what you intend to do is submit the form. People do this all the time and run into problems left and right.

    Do it the semantic way and use <form onsubmit="login()">, and <input type="submit"> instead of <input type="button">. If you do it this way the Enter key will work in all browsers automatically - no special script required (unless you hide the submit button for some reason before page load).

    2) Give your form an id instead of a name and use this:
    Code:
    window.onload = function()
    	{
    	var txt_input = document.getElementById("login").data;
    	if (txt_input.focus) txt_input.focus();
    	}
    Last edited by itsallkizza; 01-21-2009 at 07:23 AM.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    jameswsparker (01-21-2009)

  • #3
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Thank you for your swift response.
    I have to be honest with you, I don't have a clue how to lay that out.
    Can I be REALLY cheeky, Lol; I know it's rude, but I'm SOOO stuck... mm

    Would you possibly be able to put the code together for me, using the code I placed above.

    It's be soo awkward doing this; Lol;
    I basically need 2 things:
    1. for the text-box to automatically be selected on page startup and after text entry.
    2. and up on pressing the enter key, the button is automatically selected
    .
    I understand how it would work automatically using the code you provided me, I just don't know how to make any use of it; Lol.
    I'm a tad-crap when it comes to anything programming.

    Anyway, thanks again for you swift response; I'de love to hear back from u soon.

  • #4
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    I placed a series of comments in the code to help you understand what's going on - I'm happy to help teach you html/javascript so long as you genuinely want to learn
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Header</title>
    <style type="text/css">
    #login
    {
    /*	Instead of using a table, use CSS alongside block elements
    	(such as form and div) to style your form. */
    margin: 0 auto;	/* This centers your form in relation to it's parent element - in this case the body. */width: 255px;
    border: 1px solid #111111;
    text-align: center; /* This centers your input elements in relation to your form. */
    }
    
    #login .txt
    {
    /*	Set the width of your text inputs here.
    	I used the relative "em" unit because it is similar to the size="20".
    	You can also use "px" to assign a specific pixel width. */
    width: 14em;
    }
    </style>
    <!--	Use type="text/javascript" instead of the deprecated language="Javascript".
    	Also, if you are coding with an XHTML doctype, you'll need CDATA islands for page validation -->
    <script type="text/javascript">
    // <![CDATA[
    
    function loginFormSubmit(form_element)
    	{
    	var data = form_element.data.value;
    	if (data == 8)
    		{
    		// Is "main" the name of a frame under parent? It would be more modular
    		// to send this data to a function inside parent and handle it there.
    		parent.main.window.location = "8.html";
    		}
    	else alert("Could you rephrase that?");
    	return false;
    	}
    
    window.onload = function()
    	{
    	// If the browser supports the focus command for input elements,
    	// it will place the blinking cursor in your data input field when the page loads.
    	var txt_input = document.getElementById("login").data;
    	if (txt_input.focus) txt_input.focus();
    	}
    
    // ]]>
    </script>
    </head>
    <body>
    
    <form id="login" onsubmit="return loginFormSubmit(this)">
    	<input type="text" class="txt" name="data" /><br />
    	<input type="submit" value="Submit" />
    </form>
    
    </body>
    </html>
    Last edited by itsallkizza; 01-21-2009 at 03:43 PM.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    jameswsparker (01-22-2009)

  • #5
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Wow

    Dear itsallkizza, I just had to take the time to say what a bloody hero you are.
    Seriously, I have been trying to smash this together for AGES; you really don't realise how much you've just helped me.
    Thank you for everything, seriously.

    Regarding HTML, JavaScript and other popular programming languages used on the web today; I'm defintely more than interested to learn.
    Don't worry, I'm not just one of these newbies who hops on to get what I want and disappear; I intend to become a nerd one-day. Lol

    Good job though, you certainly have saved a struggle on my behalf.
    All the best. In fact, I think I may have one more thing I need to do; lol.
    But I'll get back to that another time, I'll be sure to keep you notified of my progress. Thanks again.

  • #6
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Ok, sorry to bug you again so soon; Lol.
    There is another BIG thing I would adore you forever if you could suss; Haa ha.
    Ok, basically; based upon your rather fantastic script re-do last time, everything is

    functioning perfect; just one thing I need a hand with though. :d

    Basically, I'm using the script to build a ChatBot, where you type in something; and it'll

    take you to a certain page with it's response written on it (I'm doing it this way for a

    reason, e.g. to insert hyperlinks, etc); it's a good idea, but limited due to the sentences

    I enter, having to be full sentences.

    Is there anyway I can program a random word picker, for this ChatBot?
    I intend for it to work like the AIML code used for ChatBots (if you know what that is).

    Basically, I want it to be able to take me to a certain page when it recognizes a word; such

    as 'love me', or 'who is', 'what is', or 'hello', etc and take me to a certain page.

    Now, unfortunately; such a code is awkward to make (especially for me xD); I mean, I want it

    to be able to recognize queries like this:

    When I type in: 'i like chocolate', I want it to recognize the word chocolate and take me to

    the page I've set for it.

    In the popular programming language (AIML) for ChatBots, it generally works like this:

    '* THE TIME'
    '* LOVE *'
    'WHAT IS *'

    The asterisk (*) would represent whatever you have typed in, so for example; I could type:

    WHAT IS your name?
    and it would recognize it as:
    WHAT IS *

    or...

    Do you know THE TIME?
    and it would recognize it as:
    * THE TIME

    And then taking me to the appropriate page, with the response and text on.

    So basically, the asterisk in the AIML programming code means anything, literally; if

    anything is entered for that asterisk and then the recognized word afterwards (or wherever

    it is set), it'll take you to the set page or response linked to it.

    Rather much, I intend to use the same method; where you can use an asterisk or a certain

    character to symbolise... anything!

    Everything is literally done, apart from this; if you would EVER find a way of doing this, I

    would secretly make you my best friend, Haa ha.
    I'm not kidding, you've served me wonders so far, if you managed to do this for me; I would

    be your biggest fan. Lol

    Anyway, here is a copy of the current script; as you redesigned it (I left all the comments

    in):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Header</title>
    <style type="text/css">
    #login
    {
    /* Instead of using a table, use CSS alongside block elements
    (such as form and div) to style your form. */
    margin: 0 auto; /* This centers your form in relation to it's parent element - in this case

    the body. */width: 255px;
    border: 1px solid #111111;
    text-align: center; /* This centers your input elements in relation to your form. */
    }

    #login .txt
    {
    /* Set the width of your text inputs here.
    I used the relative "em" unit because it is similar to the size="20".
    You can also use "px" to assign a specific pixel width. */
    width: 14em;
    }
    </style>
    <!-- Use type="text/javascript" instead of the deprecated language="Javascript".
    Also, if you are coding with an XHTML doctype, you'll need CDATA islands for page

    validation -->
    <script type="text/javascript">
    // <![CDATA[

    function loginFormSubmit(form_element)
    {
    var data = form_element.data.value;
    if (data == 8)
    {
    // Is "main" the name of a frame under parent? It would be more modular
    // to send this data to a function inside parent and handle it there.
    parent.main.window.location = "8.html";
    }
    else alert("Could you rephrase that?");
    return false;
    }

    window.onload = function()
    {
    // If the browser supports the focus command for input elements,
    // it will place the blinking cursor in your data input field when the page loads.
    var txt_input = document.getElementById("login").data;
    if (txt_input.focus) txt_input.focus();
    }

    // ]]>
    </script>
    </head>
    <body>

    <form id="login" onsubmit="return loginFormSubmit(this)">
    <input type="text" class="txt" name="data" /><br />
    <input type="submit" value="Submit" />
    </form>

    </body>
    </html>

    ---
    Anyway, happy programming; and all the best.
    I wish you luck, Lol. PS You are a star, I'm saying that because of the script last time; It

    worked brilliant!

  • #7
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    errr

    also when i add a new tag, it links to the page fine, eg:
    But it only works if I'm using nothing but numbers in my query, how do i make it work for text also?

    Here is a snippet of my altered code:

    function loginFormSubmit(form_element)
    {
    var data = form_element.data.value;
    if (data == 8) { parent.main.window.location = "999.html"; }
    if (data == 999) { parent.main.window.location = "test.html"; }
    if (data == calculator) { parent.main.window.location = "calculator.html"; }
    if (data == what is the time) { parent.main.window.location = "time.htm"; }
    if (data == 123) { parent.main.window.location = "chocolate.html"; }
    else alert("Could you rephrase that?");
    return false;
    }

    Everything is fine, apart from it only accept numerical values, and not alphabetical.

  • #8
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Something like this?:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Header</title>
    <style type="text/css">
    #login
    {
    margin: 0 auto;
    width: 255px;
    border: 1px solid #111111;
    text-align: center;
    }
    
    #login .txt
    {
    width: 14em;
    }
    </style>
    <script type="text/javascript">
    // <![CDATA[
    
    function containsAll(str,what)
    	{
    	what = typeof(what) == "string" ? [what] : what;
    	str = str.toLowerCase();
    	for (var i=0;i<what.length;i++)
    		{
    		if (str.indexOf(what[i].toLowerCase()) == -1) return false;
    		}
    	return true;
    	}
    
    function loginFormSubmit(form_element)
    	{
    	var data = form_element.data.value;
    	var new_loc = false;
    
    	// If the data string contains all the strings in the array, it will return true and assign the new location for the parent.main window.
    	// It's currently case insensitive so it doesn't matter if the user types it with capitals or in the same order.
    	if (containsAll(data,["what","time"])) new_loc = "time.html";
    	else if (containsAll(data,["what","your","name"])) new_loc = "tell_name.html";
    	else if (containsAll(data,["what","my","name"])) new_loc = "guess_name.html";
    	else if (containsAll(data,"calculator")) new_loc = "calculator.html";
    	else if (containsAll(data,"love")) new_loc = "love.html";
    	else if (containsAll(data,"8")) new_loc = "8.html";
    
    	if (new_loc) parent.main.window.location = new_loc;
    	else alert("Could you rephrase that?");
    	return false;
    	}
    
    window.onload = function()
    	{
    	var txt_input = document.getElementById("login").data;
    	if (txt_input.focus) txt_input.focus();
    	}
    
    // ]]>
    </script>
    </head>
    <body>
    
    <form id="login" onsubmit="return loginFormSubmit(this)">
    	<input type="text" class="txt" name="data" /><br />
    	<input type="submit" value="Submit" />
    </form>
    
    </body>
    </html>
    Last edited by itsallkizza; 01-22-2009 at 08:19 AM.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    jameswsparker (01-22-2009)

  • #9
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    You fkng rock!

    Alright mate, I think I'm in love with you; nothing homosexual, but just a little bit of straight love; probably because you are a programming god.

    You son of a gun, you've put together a perfect code for me; I really don't know how I can thank you anymore than saying it!
    Seriously though, flipping heck! haa ha.
    You are one of the most intelligent web programmers I think I've ever met on any forum, your knowledge is supreme; I am truly astonished.

    Right well, if I could repay you; I would... I honestly would, not unless it's money (I'm skint) You are a natural star!

    Well buddy, you have given such sound advice I feel some what mean not being able to give anything back to you; I honestly do, Haa ha.
    I'm really impressed; you're better than my old college web developer, and he just ripped pages apart.

    Thank you VERY much!
    I cannot stress how brilliant your aid has been to me; thanks buddy.

    If you ever require software, serials, games, music, videos, documents, government information, etc; I'm hopefully setting up a server soon, if you require anything computer software based; give me a shout.

    jameswsparker@live.co.uk.

    Anyway, you've done more than I ever expected.
    All the best.

    James W S Parker

  • #10
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Glad I could help
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    jameswsparker (01-23-2009)

  • #11
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Question Hey

    Ok, right; I have one more thing (again) Lol
    But I actually think this is the last one, this time. I honestly do. Haa ha

    You have been truly amazing so far, and everything in the code is literally complete, and running perfectly; I couldn't have asked for more...
    But there still remains one more tweak that needs applying though. Lol

    Ok, haa ha; whenever I type in my query e.g. 'what is the time' or 'hello there', into the text box it responds with it's set page (as it's meant to ); but doesn't clear the text-box automatically afterwards, which means I have to do it manually so that I can search for something else.

    The textbox is automatically cleared if it can't find the page though, otherwise the text in that box annoyingly stays there, having to be manually cleared.

    Is there anyway I could get rid of this? So that, when I type something in the text-box; straight afterwards, the text-box shall be cleared automatically afterwards and ready for some new text to be entered.

    I know I've really asked quite a lot of you, and I cannot state how much help you have been to me; you're brilliant Well, anyway; here's the current code that needs to be modified:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Header</title>
    <style type="text/css">
    #login
    {
    margin: 0 auto;
    width: 255px;
    border: 1px solid #111111;
    text-align: center;
    }

    #login .txt
    {
    width: 14em;
    }
    </style>
    <script type="text/javascript">
    // <![CDATA[

    function containsAll(str,what)
    {
    what = typeof(what) == "string" ? [what] : what;
    str = str.toLowerCase();
    for (var i=0;i<what.length;i++)
    {
    if (str.indexOf(what[i].toLowerCase()) == -1) return false;
    }
    return true;
    }

    function loginFormSubmit(form_element)
    {
    var data = form_element.data.value;
    var new_loc = false;

    // Full
    if (containsAll(data,["WHAT","IS","YOUR","NAME"])) new_loc = "AI/Full/WHAT IS YOUR NAME.htm";
    else if (containsAll(data,["CAN","YOU","HELP","ME"])) new_loc = "AI/Full/CAN YOU HELP ME.htm";
    else if (containsAll(data,["DO","YOU","FEEL","EMOTION"])) new_loc = "AI/Full/DO YOU FEEL EMOTION.htm";
    else if (containsAll(data,["TELL","ME","YOUR","OBJECTIVE"])) new_loc = "AI/Full/TELL ME YOUR OBJECTIVE.htm";
    else if (containsAll(data,["8","8","8"])) new_loc = "AI/Full/8.htm";

    // Path
    else if (containsAll(data,["WHAT","IS","YOUR"])) new_loc = "AI/Path/WHAT IS YOUR.htm";
    else if (containsAll(data,["WHAT","IS"])) new_loc = "AI/Path/WHAT IS.htm";
    else if (containsAll(data,["IS","YOUR","NAME"])) new_loc = "AI/Path/IS YOUR NAME.htm";
    else if (containsAll(data,["YOUR","NAME"])) new_loc = "AI/Path/YOUR NAME.htm";
    else if (containsAll(data,["IS","YOUR"])) new_loc = "AI/Path/IS YOUR.htm";
    else if (containsAll(data,["HELLO","THERE"])) new_loc = "AI/Path/HELLO THERE.htm";
    else if (containsAll(data,["CAN","YOU","HELP"])) new_loc = "AI/Path/CAN YOU HELP.htm";
    else if (containsAll(data,["CAN","YOU"])) new_loc = "AI/Path/CAN YOU.htm";
    else if (containsAll(data,["YOU","HELP","ME"])) new_loc = "AI/Path/YOU HELP ME.htm";
    else if (containsAll(data,["HELP","ME"])) new_loc = "AI/Path/HELP ME.htm";
    else if (containsAll(data,["YOU","HELP"])) new_loc = "AI/Path/YOU HELP.htm";
    else if (containsAll(data,["DO","YOU","FEEL"])) new_loc = "AI/Path/DO YOU FEEL.htm";
    else if (containsAll(data,["DO","YOU"])) new_loc = "AI/Path/DO YOU.htm";
    else if (containsAll(data,["YOU","FEEL","EMOTION"])) new_loc = "AI/Path/YOU FEEL EMOTION.htm";
    else if (containsAll(data,["FEEL","EMOTION"])) new_loc = "AI/Path/FEEL EMOTION.htm";
    else if (containsAll(data,["YOU","FEEL"])) new_loc = "AI/Path/YOU FEEL.htm";
    else if (containsAll(data,["I","SEE"])) new_loc = "AI/Path/I SEE.htm";
    else if (containsAll(data,["TELL","ME","YOUR"])) new_loc = "AI/Path/TELL ME YOUR.htm";
    else if (containsAll(data,["TELL","ME"])) new_loc = "AI/Path/TELL ME.htm";
    else if (containsAll(data,["ME","YOUR","OBJECTIVE"])) new_loc = "AI/Path/ME YOUR OBJECTIVE.htm";
    else if (containsAll(data,["YOUR","OBJECTIVE"])) new_loc = "AI/Path/YOUR OBJECTIVE.htm";
    else if (containsAll(data,["ME","YOUR"])) new_loc = "AI/Path/ME YOUR.htm";
    else if (containsAll(data,["8","8","8"])) new_loc = "AI/Path/8.htm";

    // Single
    else if (containsAll(data,"WHAT")) new_loc = "AI/Single/WHAT.htm";
    else if (containsAll(data,"IS")) new_loc = "AI/Single/IS.htm";
    else if (containsAll(data,"YOUR")) new_loc = "AI/Single/YOUR.htm";
    else if (containsAll(data,"NAME")) new_loc = "AI/Single/NAME.htm";
    else if (containsAll(data,"HELLO")) new_loc = "AI/Single/HELLO.htm";
    else if (containsAll(data,"THERE")) new_loc = "AI/Single/THERE.htm";
    else if (containsAll(data,"CAN")) new_loc = "AI/Single/CAN.htm";
    else if (containsAll(data,"YOU")) new_loc = "AI/Single/YOU.htm";
    else if (containsAll(data,"HELP")) new_loc = "AI/Single/HELP.htm";
    else if (containsAll(data,"ME")) new_loc = "AI/Single/ME.htm";
    else if (containsAll(data,"DO")) new_loc = "AI/Single/DO.htm";
    else if (containsAll(data,"FEEL")) new_loc = "AI/Single/FEEL.htm";
    else if (containsAll(data,"EMOTION")) new_loc = "AI/Single/EMOTION.htm";
    else if (containsAll(data,"I")) new_loc = "AI/Single/I.htm";
    else if (containsAll(data,"SEE")) new_loc = "AI/Single/SEE.htm";
    else if (containsAll(data,"TELL")) new_loc = "AI/Single/TELL.htm";
    else if (containsAll(data,"OBJECTIVE")) new_loc = "AI/Single/OBJECTIVE.htm";
    else if (containsAll(data,"8")) new_loc = "AI/Single/8.htm";

    if (new_loc) parent.main.window.location = new_loc;
    else parent.main.window.location="AI/Other/UNKNOWN RESPONSE.htm"; done=1;
    return false;
    }

    window.onload = function()
    {
    var txt_input = document.getElementById("login").data;
    if (txt_input.focus) txt_input.focus();
    }

    // ]]>
    </script>
    </head>
    <body>

    <form id="login" onsubmit="return loginFormSubmit(this)">
    <input type="text" class="txt" name="data" /><br />
    <input type="submit" value="Respond" />
    </form>

    <p><font size="2">Copyright © James William Steven Parker, All Rights Reserved</font></p>

    </body>
    </html>


    ---

    Once I have this issue out the way, then I think everything is near enough going to be complete. ; And all I'll have to do is make it more intelligent.

    Anyway buddy, I would love to hear from you again.
    In the meanwhile though, all the best...

  • #12
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    This will clear the text input every time the user hits submit:
    Code:
    function loginFormSubmit(form_element)
    	{
    	var data = form_element.data.value;
    	var new_loc = false;
    	
    	/*
    	REDIRECT CODE HERE
    	*/
    
    	if (new_loc) parent.main.window.location = new_loc;
    	else alert("Could you rephrase that?");
    	form_element.data.value = "";
    	if (form_element.data.focus) form_element.data.focus();
    	return false;
    	}
    If you only want to clear the text input if they submitted a valid entry:
    Code:
    function loginFormSubmit(form_element)
    	{
    	var data = form_element.data.value;
    	var new_loc = false;
    	
    	/*
    	REDIRECT CODE HERE
    	*/
    
    	if (new_loc)
    		{
    		parent.main.window.location = new_loc;
    		form_element.data.value = "";
    		if (form_element.data.focus) form_element.data.focus();
    		}
    	else alert("Could you rephrase that?");
    	return false;
    	}
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    jameswsparker (01-23-2009)

  • #13
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts
    You know what?

    Sometimes I wonder how I could even do this without you?
    Genius as always...

    Thank you ever so much! Your knowledge really shows no boundries.

    Everything in this script is working like a charm now.
    All thanks to you.

    First of all, this script was nothing; and did only the minimum.
    And now; it doesn't even more than I intended it to do. Thanks again...

    All the best.

  • #14
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Anytime
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • #15
    New Coder
    Join Date
    Jan 2009
    Location
    Bristol, England
    Posts
    43
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Internet Explorer Cheers buddy.

    Thanks again.
    Last edited by jameswsparker; 01-24-2009 at 03:42 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •