Jump to content

blacksharkmedia

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

blacksharkmedia's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hy, That div is inside another div, a container, and yes it was a trial and error positioning, the design is pretty simple so it won't be modified on the future. Thanks
  2. Yes I'm amased too, but curiously it displays ok in both firefox & IE. Thanks for the answers but I will not use this solution anymore, in exchange I will make use of POST and GET and I will finish it in 2 sec. Thanks again for the help
  3. Many thanks for the replay I've tested the example you provided and it works with default values but not to the ones I have(my right div has custom position) <script type="text/javascript"> function showContent(menuID) { var index = 1; var divObj; while(document.getElementById('content_' + index)) { divObj = document.getElementById('content_'+index); divObj.style.display = (index==menuID) ? 'block' : 'none'; index++; } return; } </script> <div id="menu" style="border:1px solid black;float:left;"> <a onclick="showContent('1');">Menu 1</a><br /> <a onclick="showContent('2');">Menu 2</a><br /> <a onclick="showContent('3');">Menu 3</a><br /> </div> <div id="content_1" style=" width: 260px;height: 490px;position:relative;right: 20px;top: -475px;overflow: hidden;float:right;display:none;"> Content for menu item 1<br /> Content for menu item 1<br /> Content for menu item 1<br /> </div>
  4. Hello all, I have a layout with 2 sides(left side and right side). I get from mysql the menus name and content text for every menu. I want when I click o a menu on the left side div to display in the right side div the content text for that menu. Example: LEFT SIDE div | RIGHT SIDE div ______________|_____________ Left menu1 | menu1 content text Left menu2 | content text menu1 any ideas?
  5. Modify the script, and add the $url $url = "http://www.domain.com/users/file.xml"; Then change "$x = simplexml_load_string($xml);" to $x = simplexml_load_string(file_get_contents($url));
  6. Why not use MySql? You can make 2 new fields along product/page details in your mysql table like seo_title, seo_description, seo_keywords... And on the page you just display them acording to your product/page ID from url or sessions. This way you cand modify them any time you add a new product/page from the admin pannel
  7. 1. Did you look at the sample output? How were the color assignments NOT random? Did you even bother reading the code to understand what is happening? I added plenty of comments so that anyone analyzing the code could understand how the colors were being randomized. But, I guess I have to hold your hand. So, after creating an array of 1 to 100 in sequential order, the next step will shuffle() the array to put all the values in a random order - but the index of the values will be from 0 to 99. So, half of the random vaues are in indexes 0 to 49 and the other half of random values are in indexes 50 to 99. Using this line: color = ($index<50) ? 'W' : 'B'; The values in the first 50 indexes are given a color of "W", while the last 50 are given "B". BUt, they are in a random order, so the color is evenly distributed - randomly - across all the values. 2. It's not that hard, but I can see where you might have some difficulty. I could just as easily implement in the code I provided above, but decided to change the approach just for my personal interest. So, here is revised code with LOTS of comments. Be sure to look at the last line and either keep or remove that line depending upon whether you want to allow for duplicate results. I also added some debugging lines so you can see the gernerated array of possibilities. Lastly, the two variables at the top allow you to change how many possibilities and how many generated numbers are created without touching the rest of the code. <?php //Number of possible numbers $maxPossible = 100; //Number of generated attempts $maxAttempts = 10; //Create separate arrays for W and B (1/2 of $maxPossible each) $white = array_fill(1, ceil($maxPossible/2), 'W'); $black = array_fill(1, floor($maxPossible/2), 'B'); //Create combined array first half 'W' and 2nd 1/2 half 'B' $colors = array_merge($white, $black); //Randomize the array (i.e. indexes 0 to n are randomly assigned W or B) shuffle($colors); //Append the colors to an array value of 0 at the 0 index //indexes 1 to $maxPossible have randomly assinged W or B $possibilities = array_merge(array(0), $colors); //The followng lines are for illustrative purposes only //Remove after you see how the array is generated echo "<pre>"; print_r($possibilities); echo "</pre>"; ///////////////////// for($attempt=0; $attempt<$maxAttempts; $attempt++) { //Generate a random number $generatedNumber = array_rand($possibilities); //Determine the results if($generatedNumber==0) { //Value was 0 $result = '-> (value was zero)'; } else { //Value was not 0, determine color and box $color = $possibilities[$generatedNumber]; $box = ceil($generatedNumber/($maxPossible/4)); $result = "-> it displays {$color}{$generatedNumber} - Box{$box}"; } //Output the results echo "Generated number: {$generatedNumber} {$result}<br />\n"; //Remove generated number from possibilities (if you don't want to allow diplicates) unset($possibleNumbers[$index]); } ?> hello, I didn't meant not random like rand() function but random like not generated and more like static declared $White = array(2,4,6,8,10,11,13,15); I've adapted the script to my needs. Thank you very much for the time and quick response.
  8. Many thans for the ideea. It works fine. Also I have some tweeks for it: 1. The color codes are not secvential! From the total of 100 numbers 50 are chosen manualy to be W and 50 B and declared at simulation start. 2. 0 should be introduced to simulation, if shows up in random function then display a message like "0 was find" Thanks again
  9. are there any errors in server logs?
  10. Hello, I wanna make an application to run some simulations: 1. I have numbers from 0-100 2. 50 numbers are White, and 50 numbers are Black, 0 does not have any color The numbers are assigned by default in config to a color code ex: W: 1,4,6,34,65... B:2,3,11,... So what is found in color code W you won't find in color code B. 3. The 100 numbers are divided in 4 equal boxes ex: box1: 1-25, box2: 26-50, etc.. in every box is present also the W and the B color codes. 4. So the problem is that I want for every random(from 0-100) number generated to be automaticaly color coded using the default config color codes(w or b) and to be assigned to one of the 4 groups. If the number 0 is generated to display a message. Example W(white): 1,3,5,7,9,12,... B(black): 6,8,11,67,44,... Box1: 1-25 Box2: 26-50 Box3: 51-75 Box4: 75-100 Generated number: 7 -> it displays W7 - box1 Generated number: 67 -> it displays B67 - Box3 The number of random generations to be config by default to 10 Any ideas on how this can be implemented using php/mysql/arrays/etc..? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.