It's a great language. Simple to use and work with.
Usually I'll have the code on a webpage (form) do something with the data and then spit it over to a php script for further processing.
As always, the biggest issue is what the program is to be used for. General business type websites (the kind where you advertise your business, etc) generally *need* very little.
Designing applications to run inside a browser would be a different animal entirely.
Debugging tip: when pulling data from a form watch the variable type. I once spent 2 hours (not too long ago either I'm afraid to admit) tracking down a bug where the integer value 0 was confused with the string character 0
JS
Announcement
Collapse
No announcement yet.
javascript in your web page, never say never
Collapse
X
-
Amazing things can be done in Javascript.
Like a NES emulator:
Bye!
Leave a comment:
-
-
The executable files produced by powerbasic do not run on the client's side unless you transfer the exe to the client's side then execute the exe on the clients side.
Leave a comment:
-
-
Well i just could not resist yanking MCM's chain a little bit, of course there is no way to run a exe on the clients side without some kind of script.
I know more about javascript than C. Trust me, that ain't much.
The code was in PHP becuase of the linux server, but i would believe most people could follow the javascript example without much effort. One of the main reasons i wanted to share that, is because many times lately i have had to fill out something on a webform and not filling out the form to the servers satisfaction it kicked back the form and i could not see easily the problem to fix. My eyes are getting weaker, dimmer and fuzzier. I also do not lilke to look around for over ten seconds to find what i did wrong. I probably am not the only one using large screens, with tiny print or small screens with tinyer print.
In windows 2000 pro when you log on, there are two fields, a username and a password. Over two months ago, i started making locking down the computers, making it where you have to login from a boot or a lockout from a screen saver. One person complained because they could not login.
The username they where trying to login was the administrator, not the username. Before, the computer would login automatically after a boot.
So there it was just those two freaking fields. On windows, you have to type in the username if it was not the last logged in username you wanted to use. So it just goes to show you how something so easy can be so fustrating to somebody. And i specially do not want to fustrate any of my customers.
I just thought those like me would like to have another way to do things on their webpages they are writing without having to be a knowledgable javascript programmer. Maybe those short pieces of code can save somebody a lot of time, then again maybe not.
Thanks for the responses and maybe in the future, i will have some more javascript tidbit pieces. If you want to be the best learn from the best.
Thank God I have this forum to use.
Leave a comment:
-
-
For me, javascript is indispensable.
My general web philosophy is to do anything that can be done on the client side (i.e. validations, computations, dynamic cosmetic effects, etc), and just do data manipulation on the server. Of course, this is dependant on the dynamic of the web site you are developing but it's my rule of thumb.
Leave a comment:
-
-
Originally posted by John Strasser View PostHi Ivan,
Actually, you would be better served using BOTH - javascript in the page to do an initial check (valid email address, all fields filled in etc) and then on the server to validate the data.
JS
Leave a comment:
-
-
Hi Ivan,
Actually, you would be better served using BOTH - javascript in the page to do an initial check (valid email address, all fields filled in etc) and then on the server to validate the data.
JS
Leave a comment:
-
-
A little piece of advise, do not use JavaScript to verify fields instead, rely on PHP, after you POST you verify it, for example:
PHP Code:
$user_name = $_POST["UserName"]; // In this example, UserName is the name of the EDITBOX on your HTML FORM
if (empty($user_name)) {
echo "Please enter User Name";
}
Leave a comment:
-
-
Originally posted by paul d purvis View PostShame on all you people that know javascript and have not offered up some tidbits.
Often website that rely on javascript become BLOATWARE that is a real PITA to work with. Many web pages that rely on js are using all sorts of libraries which all have to be downloaded.
In fact, I have found very few instances where javascript is *required* in a webpage (client side form validation being an obvious one).
Is it useful? Heck yeah. Having the ability to create custom event handlers etc is always useful.
But it's still just a tool.
Fwiw, yours is the first post I've seen here with any sort of javascript question.
On a side note, why did you break your php code up that way? You might find it easier to use the enddoc form of the echo
echo <<<MARKER
this is what would print
MARKER
given that you had to escape the double quotes around $msg so it would print, or even output buffering (printing to a string variable)
I usually find it easiest to include the following (as a php include) as part of the website "datafile" for every site I use php on.
//HTML codes as variables - easier creation
$DQ = chr(34); //double quote
$SQ = chr(39); //single quote
$SEMI = chr(59); //semicolon
$SPC = chr(32); //space
Similarities to the PB constants completely intentional <grin>.
Real easy then to build complex strings if I don't want to use enddoc.
Leave a comment:
-
-
Michael, save yourself some time and don't bother looking for it, but there might should be.
The executable files produced by powerbasic do not run on the client's side unless you transfer the exe to the client's side then execute the exe on the clients side. By using powerbasic to create a smaller sized exes, it will be more efficient for the web connection to transfer the smaller sized exes than other exes produced by other platforms and you will also not have to worry too much about your exe program needing other installed utilities such as .NET or JAVA that may not be installed on the clients os. Just make sure the client's side is a windows os, which most often they are.Last edited by Paul Purvis; 14 Sep 2009, 01:03 AM.
Leave a comment:
-
-
Shame on all you people that know javascript and have not offered up some tidbits.
Amazing.
Leave a comment:
-
-
javascript in your web page, never say never
Shame on all you people that know javascript and have not offered up some tidbits.
I did want to say that I would never ever use javascript unless forced to in a web page, but I know better than to say "NEVER". I do not like the word "script" included in the same sentence with the words "web page". And I did not want to learn something new to program with, my head has enough to accomplish what needs to be done with the tools I have.
But I came across some javascript language in learning some php programming code, why you ask? Because Powerbasic does not do CGI on a Linux OS. HINT! HINT! It is ok, none of my users use linux as a desktop anyways.
Well my hand has now been twisted to do some javascript code because I found three little variations of similiar javascript code that you can use in your powerbasic coded cgi programs.
I actual did not use all three javascript functions of code yet but there are three useful javascript functions I like: ALERT, CONFIRM AND PROMPT
My php html code only uses the javascript ALERT function now, but i will surely use the CONFIRM and the PROMPT code too.
Here it is and do not ask me what the "history.go" is, I do not know, look it up, it will fun. NOT!
This piece of php code is some of what i am using but the functions can be easily created into powerbasic code. the web page i wrote calls itself over and over in a web page form program i wrote to send emails. the function "message" calls the other two functions "header" and "footer", so "message" is the main function for me that i call.
the variable "$msg" in the function "message" might be assigned "you did not fill in the email field". All this is similar to MSGBOX and it might actually be the same thing except for you can have the user input a line using the PROMPT function.
Code:function header() { ?> <HTML> <HEAD><TITLE>javascript to use</TITLE></HEAD> <BODY> <?php } function footer() { ?> </BODY> </HTML> <?php } function message($msg) { header(); echo "<SCRIPT>alert(\"$msg\");history.go(-1)</SCRIPT>"; footer(); exit; }
i am just bringing this to your attention so you can do a search and find out more about these three pieces of javascript functions, ALERT, CONFIRM, PROMPT.
Code:<HTML> <HEAD><TITLE>javascript to use </TITLE></HEAD> <BODY> <script language="JavaScript"> alert("Error: you made a error.") </script> </BODY> </HTML> <HTML> <HEAD><TITLE>javascript to use </TITLE></HEAD> <BODY> <script language="JavaScript"> var temp=confirm("Do you really want to do this?") if(temp) window.location="hewantstodothis.htm" </script> </BODY> </HTML> <HTML> <HEAD><TITLE>javascript to use </TITLE></HEAD> <BODY> <script language="JavaScript"> var temp=prompt("you missed this entry, enter your email address, ") </script> </BODY> </HTML>
I like this better than placing some stupid little red colored asterick mark you barely can see in a form, but it is ok if you do not want the user to have to run any javascript, but what freaking web page these days do not have javascript on them, HUH. This is so much better also for blind people, yes, you know exactly who i am talking about.Last edited by Paul Purvis; 13 Sep 2009, 02:19 AM.Tags: None
-
Leave a comment: