-
Content Count
33 -
Joined
-
Last visited
Everything posted by peroim
-
How Do I Check If A Parent Page Is Loading Data?
peroim replied to kvarnerexpress's topic in Programming
Just add a onload event on your popup for the basic window, before it fires, the page isn't loaded, after, it is. -
It's not that hard to make that! I'll explain it to you using a simple code: var numarray = new Array(1, 1, 1, 2, 2, 2, 3, 4);/* This is the array of possible values. The more times you use a number, the more times it will return. */var rand = Math.round(Math.random()*(numarray.length-1));/* This code creates a random number between 0 and (numarray.length-1). */var num = numarray[rand];/* This piece will take a value out of the array, based on the random number of the second line of code. */ And this will always return one of the values you want! Of course, you speak of a function that returns a value, so it will be more like this: function randomNumber(){var numarray = new Array(1, 1, 1, 2, 2, 2, 3, 4);var rand = Math.round(Math.random()*(numarray.length-1));var num = numarray[rand];return num;}
-
How about reading the file, make it explode at '::' and then add the pieces that don't contain 'sucks'? The code would look like this: <PHP$newcontent = ""; //Just setting a variable$file = ("yourfile.txt"); //This is your file$opened = fopen($file, "r"); //This is where we open the file to read from it$filecontent = fread($opened, filesize($file)); //Now, we're reading the fileclose($opened); //And closing$filecontent = explode("::", $filecontent); //Now the exploding of the variableforeach($filecontent => $value){ //A loop that will run once for each piece of the array (I'm not really sure of this syntaxif($value != "sucks"){ //If the piece is NOT "sucks", we continue$newcontent = $newcontent.$value."::"; //Adding the piece + "::" to a variable}}$opened = fopen($file, "w"); //Now open the file again to writefwrite($opened, $newcontent); //Put the data in the fileclose($opened); //Close the file and we're done?> I didn't test the code but I think it would work
-
This is what i found about str_repeat(): string str_repeat ( string input, int multiplier ) Gives multiplier repeats of input_str. multiplier has to be greater or equal to 0. If multiplier is 0, this fuction will return an empty string. (Sorry for the possibly bad English, but I had to translate this from Dutch.)
-
Indeed, I learned JavaScript, HTML, CSS, ... by the source codes of other people. And as Rvalkass said: anyone can write exactly the same. I think that you can't hide your source because other people might want to learn from that source (just like I did).And speaking of sourcecodes, does someone know how you can view a PHP-source? (If it is possible, of course.)
-
if you really want it in HTML and java script: Insert this in the HEAD of you page: <script language='JavaScript'>var time = 15; //How long (in seconds) to countdownvar page = "yourpage.htm"; //The page to redirect tofunction countDown(){time--;gett("container").innerHTML = time;if(time == -1){window.location = page;}}function gett(id){if(document.getElementById) return document.getElementById(id);if(document.all) return document.all.id;if(document.layers) return document.layers.id;if(window.opera) return window.opera.id;}function init(){if(gett('container')){setInterval(countDown, 1000);gett("container").innerHTML = time;}else{setTimeout(init, 50);}}document.onload = init();</SCRIPT> And this in the body of the page (where you want the countdown to appear): <span id='container'></span>
-
I think most search engines will try to index your complete site (if you say so in robots.txt) and take both pages.