JavaScript

Hi there

    Only minor things in the beginning. The date and time on the HomePage is a combination of JavaScript and Forms. The code, which I "borrowed", was originally set up to display the time only in a Text Form box. I added the date. Then because of the differences in the length of the day and month names, the dispay was off center and looked crappy. So, I changed the input type to button and it all looked better. I may even get the button to do something ... later.

    One of the nice things about using JavaScript to display the time is that JavaScript works on the Client Side. This will mean that the time displayed will be as accurate as the client's, or owner's, PC. No need for GMT compansations or daylight savings or anything. It will be their time. Client side ops do have their values.

    Also using JavaScript in the date modified at the bottom of the pages. However, I may have to change that. For one thing, the date that shows is the date I place it on my ISP. Which isn't bad but ... it changes as the animated figures change or something. Anyway, the current display of last date changed is not correct on all pages.

Well, it's later.

     The button with the date and time on the front page now does something. If you click on the button, it will tell you how much time you have spent logged onto my WebSite. Problem is ... it is only for that page. On a couple of my selections, I bring another page into the main window on top of the front page. This changes the visit time. So, I must make sure that all selections come up in new pages or just not worry about it. The later is probably better.

    And I am using JavaScript with FORMS, PHP and MySQL in my Customer Database Creation. One of the primary uses is to open windows of selective sizes.

    

	Document Object Model

	    |- Window
	        |- Document
		      |- Anchors
		      |- Forms
		         |- Buttons
		         |- Check Boxes
		         |- Radio Buttons
		         |- Select Lists
		         |- Text Boxes
		         |- Text Areas
		         |- Password
		         |- Hidden
		         |- Submit Button
		         |- Reset Button
		      |- Links
		      |- Images
	        |- Frames
	        |- History
	        |- Location

	Other Built-In JavaScript Objects
		Array
		Date
		Math
		Navigator
		String

Windowing from a Form

    I spent considerable time investigating how to pass values from a form through a JavaScript routine to a PHP script. The following is what I observed and learned.

    First we have the Form:
<form name="MNUmodcustfrm" id="MNUmodcustfrm" method="POST" action=""
    onsubmit="launchwin('PickModCust.php?Clientval='+document.MNUmodcustfrm.client.value,             'pickmod' , 'width=500,height=360')">
    <input type="Text" name="client" size="20" maxlength="20">
    <input value="Modify a Customer" type="submit">
</form>

    Please notice, the form and the text field both have names. These are to be used to get the value to pass to the PHP script. This will allow us to once again have a singular JavaScript that will open a window for us. I'm sorry that the line had to break but I believe that it is intuitivly obvious how the puncuation is to be used. Now then, I got this straightened out from a forum conversation at: HTML Help. Strangely enogh they were discussing ASP but it applies to JavaScript also.

window.open('./.asp?arg1='+q1+'&arg2='+q2+'&arg3='+q3, '','toolbar=0,location=0,
   directories=0,status=0,me nubar=0,scrollbars=0,resizable=0',true);

Now please notice, that, if there is more than 1 argument, that there is a difference in the way they are included. Notice the '&' in front of the second and third args. This is obtaining the address of the variable.

    

    



Copyright © 2004-2004 Chuck Taylor. All rights reserved.