Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by aleksanteri

  1. I found on the XMLDOM tutorial that you can do a test on creating ADO objects."window.ActiveXObject" returns boolean true when the browser is IE (or should be)."(document.implementation && document.implementation.createDocument)" returns true when the browser is Mozilla etc etc.And now comes the coolest part. What if you can test that can it handle it. You can't give support to browser in the "Edit Preferences" section, eh? So: <script type="text/javascript">var browser = navigator.appNameif (!window.ActiveXObject && !document.implementation && !document.implementation.createDocument){alert("Your browser will not execute the slideshow script" + '\n' "It must be viewed in either Internet Explorer or Firefox")}</script> Note I'm not 100% sure about does this script work, but I think it should work... expect when Opera can return true in "(document.implementation && document.implementation.createDocument)", that might be a bummer that I'm really afraid of.
  2. You could use: <html><head><script type="text/javascript">function comment_timeout(){ setTimeout("document.getElementById('comment_form').submit()", 100*60*3);}</script></head><body onload="comment_timeout()"><form id="comment_form" action="submitcomment.php"><!-- some inputs --></form><p>Your comment will be automaticly submitted in 3 minutes.</p>
  3. IT Press.It provides a lot of examples, at least did for me! Good books, must admit.
  4. Found your mistake. <html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Language" content="en"> <meta name="Author" content="Sniffy Gerbil"> <title>Welcome to Bobville!</title> <link rel="stylesheet" type="text/css" href="stylesheet.css"></head><frameset cols="120,*, 120" border="0"> <frame src="http://bobville.1500mb.com/menu.html" name="navigation" scrolling="no" noresize="noresize"> <frameset rows="100,*"> <frame src="http://bobville.1500mb.com/header.html" name="logo" scrolling="no" noresize="noresize"> <frame src="http://bobville.1500mb.com/index2.html" name="main" scrolling="auto" noresize="noresize"> </frameset> <frame src="http://bobville.1500mb.com/link.html" name="rightside" scrolling="no" noresize="noresize"></frameset><noframes><body>Your browser does not support frames!</body></noframes></html> The error was that you had <frameset> inside the <body> element. <frameset> should be considered in the same priority as <body> and <head>.This is wrong:html head /head body frameset /frameset /body/html... and this is right:html head /head frameset /frameset body /body/htmlGahhh, looks like someone got me first.
  5. Well that could work... but if the owner has 3+ pets?You should create a span area and every time when clicking on a button, it adds a control to the span area.I could write the code for you but I can't get it working. However, I found this page that has the code you need.
  6. You can find a function from the PHP manual.Image of searchYou can enter a full function name or keywords like "match". When keywords, PHP lists some suggestions and really good matches are in bold. Click on one and you find a full reference to the function.
  7. Just came in mind that you could use VBScript to format the message box. <html><body><?php print("<script type=\"text/vbscript\">msgbox(\"Warning, your computer hasn't allocated enough memory to display this message box. Click OK to continue\",16,\"Warning\")\n</script>");</body></html>
  8. Yeah, for constants though I use uppercase.- variables lowercase $myvar; $anothervar - functions (including built-in) lowercase checkpass(); print(); - constants uppercase (as I mentioned above) define("TEN_BY_TEN", (10*10)); $hundred = TEN_BY_TEN; - keywords lowercase if($x == 5) print("\$x is 5"); - operators if in letters copy($file, $dir) or print("Couldn't copy $file"); if($x == 5 and $y == 5) print("Both \$x and \$y are 5"); I also have a habit of having print() having parenthenses. I never use echo but if I would it wouldn't have semicolons as PHP Group wrote in their manual that echo is more a statement instead of a function and print is more a function instead of a statement. My habit has all functions having parenthenses and statements have only if required.
  9. The filename is case sensitive.Check the folder and write it exactly as in the file.
  10. Just was thinking what other members have as their keyword/function habit.I do use lowercase letters for both keywords and functions.
  11. I agree, sessions are a good thing in PHP, I didn't just know there is a special variable like _SESSION["var"]. I was registering ALL my variables when I was testing a login script! (actually I had only two of them, one for username and one for password)Usernames and passwords in a login script needs to go with "POST" for security reasons. I remember one page with a login script with "GET". Were they mad? I logged in one time and came never back.
  12. It could be: $spam = array("blah", "blah");// add another spam$spam[] = "blah"; SO: You can leave the index out! PHP will add the index automaticly.
  13. Only PHP 5 has destructors, PHP 4 does not.<{POST_SNAPBACK}> All right, I checked my @&£$*! book, it was teaching me PHP 4. :)Good I did download the latest version of PHP (v.5.1.2)
  14. I think it is the other way around, <nowrap> is an element and <nobr> is not.
  15. I have been using Notepad2 for a long time... I used to do it with Notepad (original) and when I got Notepad2 (it was on some computer CD), I began using it and never looked back anymore Although it has some errors. It doesn't see <embed> as a real tag, and attribute runat is not a real attribute.Oh well, it is still the best I have (and it is so familiar to me )
  16. $_POST[$var] is the special variable with $var as the query (same as the name attribute on the form input). The isset keyword function returns true when the variable is set posted, like on a page www.somepage.com?query=value, isset(_GET["query"]) would return true, but isset(_GET["secondquery"]) would return false. You can use this by:if(isset(_POST['var'])){ // code to be run when var has been posted within the form}if(!isset(_POST['var'])){ // code to be run when var has been not posted within the form}
  17. Oh? Why my @&£$*! book didn't tell me about destructors then?Well, thanks. So it is after all? I was so used of using XHTML Strict
  18. Java can be used in internet, in the applet form. Java can be run by any major browser I know (IE, FireFox, Opera). I do quess Java can handle cookies. How, that I don't know (I'm not a Java-master-expert though! )Check this out BTW.
  19. Oh? I learned PHP from a book from the library, it says that to execute code straight, you need to make a method with the name of the class. It also says that you need to use the var keyword in variables in classes. It does still say that you don't need the var keyword outside the class... I just checked the http://www.w3schools.com/tags/tag_a.asp page, if target="_blank" would have been deprecated it would have been written there.I want to execute just the first function and the displayLanguage() after.Besides all, I have tested this out and noted it works. BTW, what's the difference between public and private variables?
  20. Then it should be like: foreach($array as $val){if (empty($array)) // check that it is not empty{echo "array position " . $i . "is filled with " . array[$i] . " <br />";}}
  21. <?phprequire($file);?>
  22. I like PHP objects, you can create multiple instances. Especially the methods is a feature I like. <html><head><style type="text/css">body{font-family: verdana}a, a:visited{color:#00f}a:hover{background-color:#408}</style></head><body><?phpclass WWWLanguage{ var $name; var $link; var $description; function WWWLanguage($name, $link, $description) { $this->name = $name; $this->link = $link; $this->description = $description; } function displayLanguage() { print("<p><a href=\"http:\\\\www.w3schools.com\\$this->link\" target\"_blank\">$this->name</a><br />\n"); print("$this->description</p>\n"); }}$html = new WWWLanguage("HTML", "html", "The basic WWW building language.");$html -> displayLanguage();$vbs = new WWWLanguage("VBScript", "vbscript", "ASP's default scripting language");$vbs -> displayLanguage();$js = new WWWLanguage("JavaScript", "js", "The most common scripting language");$js -> displayLanguage();$php = new WWWLanguage("PHP", "php", "The best serverside scripting language in the world!");$php -> displayLanguage();?></body></html> A class with a method with a name same than it's parent class does execute the method immediatly (what is demonstrated at the code above)
  23. Here is the valid code in syntax... but I didn't know you can have empty arrays. (no wonder, I just got my PWS support PHP) for($i = 0; $i <= SomeFunctionThatTellsTheCellAmount; ++$i){if($arr[$i] != "") // check that it is empty{$i++; // lets do next...echo "array position " . $i . "is filled with " . array[$i] . " <br />";}} I dunno does this work but have a try.
  24. aleksanteri

    Php and apache

    I have *.asp and *.php files in the same folder.The folder has given full rights.When I open an ASP file, the file executing works just fine.When I open a PHP file, I get an 403.1 error. --------------------------------------------------------------------EDIT: Heeey, wait now... I checked my virtual folders, there was another folder with the same path, and the cgi-bin with no rights!!!! Ok, I gave all folders full rights (this is localhost) and my PHP works!!! Wov, ROCKS!!!!
  25. aleksanteri

    Php and apache

    I mean that I get a 403 error when I'm opening a PHP file via PWS, which works with ASP. It says that I need to give rights to run the PHP in PWS. How do I do this?
  • Create New...