Jump to content

Psycho

Moderators
  • Posts

    12,157
  • Joined

  • Last visited

  • Days Won

    129

Everything posted by Psycho

  1. How do you have your teams and players stored/assigned now? Are they in a database, hard coded, or what? Show us how you create/utilize tehm now and more specific help can be given.
  2. That would be calling a javascript function, which I am guessing you downloaded from somewhere. The values would come from the javascript and not the user's settings.
  3. There is absolutely no reason to use Javascript to make an element hidden on page load! Javascript should only be used to modify content after the page loads. The reason that code is not working would depend on a few differnt things (such as where, exactly, that code is on the page in relation to the other content). But, that's not the right way to do it in any event. You just need to set the style of the div directly through style attributes like this <?php $gt = $_REQUEST['gt']; $theRestStyle = ($gt!=='') ? '' : 'display:none;'; ?> <div id="therest" style="<?php echo $theRestStyle; ?>">Div Content goes here</div>
  4. The answer to your question is simple [object].parentNode.id onchange="unhighlight(this.parentNode.id)" But, I would suggest you just pass the object (i.e. 'this') in the function call and then determine the parent ID in the function: onchange="unhighlight(this)"
  5. That is what SSL is for. Hashing the password with JavaScript is just plain dumb. What happens for users without JavaScript enabled, such as peple using some hand-held devices, blind people using screen readers, or just anyone who does not want JS enabled for security reasons. Then you have to account for the fact that there are many different browsers out there and some have peculiarities on how they interpret JS. Are you willing to test every version of every browser to make sure your JS works correctly in each one? As a rule, using JavaScript should never be a requirement for a site (there are a few exceptions).
  6. I agree with the last. Just put EUF as text just before the input field, so the user knows to enter the EUF code without the EUF text. Then add EUF to the input on the server-side before you use it. Something like: EUF<input type="text" name="EUFCode" />
  7. What you are describing sounds like a pretty poor implementation that is not very flexible as you cannot have fields with similar names/values else you would get unintended matches. Oh well, based upon what you describe, this should work: <?php function returnPartialMatch($array, $search) { //Iterrate through each value in array foreach($array as $value) { //If value has search string, return value if(strpos($value, $search)!==false) { return $value; } } //No match return false return false; } ?>
  8. I would go with what MadTechie posted in Reply#4, except there was an errant, extra single quote at the beginning of the image src attribute <?php echo "<a href=\"{$row['imgpath']}\" onClick=\"window.open('{$row['imgpath']}', width=350, height=350); return false\"><img src=\"{$row['imgpath']}\" width=\"150\" alt=\"\" border=\"0\"></a>"; ?>
  9. I disagree. If all you're looking to do is alter the number of elements you can see at one time, the size attribute is what you need. The size attribute will make the select list "fixed" to that size. The OP wants a standard drop-down with only one item visible with an expander button and when expanded is only X items high. Ah, that's a good idea. I was going to advise against a custom select list, but that will work even for someone without JS.
  10. Wow, I think there is a LOT of confusion in this post. I *think* I understand the OP request, let me restate for clarity. The OP has a select list with 190 items in it. He only wants the user to select ONE item. However, when the user selects the drop-down arrow, the slect list expands into a scrolling list. That expanded list is big enough for 16 items to be viewable at a time. The OP would like that expanded list to only be big enough to have 10 items visibile at a time. I agree with Axeia above, I don't think it is possible. The length of the expanded box is controlled by the BROWSER. I did a test and it is different in IE & FF. I think the only way you can do what you want is by creting a JavaScript select list.
  11. Nothing wrong. The second method is creating an array. You need to access the data as an array. If you use this: <input type="text" name="screen[]" value="" /> <input type="text" name="screen[]" value="" /> Then you can access the array in this manner: $_POST['screen'][0] = first value; $_POST['screen'][1] = second value; etc...
  12. You know I just realized that I am needlessly converting the data twice - ending up with what I started! It would make more sense to just echo the date from the DB and append the GMT part <span id="countdown1"><? echo $endProductionTime . date(' \G\M\TO'); ?> </span>
  13. <span id="countdown1"><? echo date('Y-m-d H:i:s \G\M\TO', strtotime($endProductionTime)); ?> </span>
  14. Added some code to ensure a proper email is created. This will replce spaces with an underscore and will remove any invalid characters (not a-z, 0-9, underscore "_", dash "-" or period "."). <html> <head> <script> function suggestEmail() { //Create references to the fields var fNameObj = document.getElementById('fname'); var lNameObj = document.getElementById('lname'); var eMailObj = document.getElementById('email'); //Set suggested email if firt & last names have value and email does not if (fNameObj.value && lNameObj.value && !eMailObj.value) { var uname = fNameObj.value + '.' + lNameObj.value; uname = uname.replace(/[ ]/g, '_'); uname = uname.replace(/[^\w\d-\.]/gi, ''); eMailObj.value = uname + '@domainname.com'; } return; } // </script> </head> <body> <form name="myform"> First Name: <input type="text" name="fname" id="fname" onchange="suggestEmail();" /><br /> Surname: <input type="text" name="lname" id="lanme" onchange="suggestEmail();" /><br /> Email Address: <input type="text" name="email" id="email" /><br /> </form> </body> </html>
  15. This should get you started. Note that I would suggest adding some code to remove/replace characters that are invalid for an email. For example a last name like "De la hoya" or "O'Doyle" <html> <head> <script> function suggestEmail() { //Create references to the fields var fName = document.getElementById('fname'); var lName = document.getElementById('lname'); var eMail = document.getElementById('email'); //Set suggested email if firt & last names have value and email does not if (fName.value && lName.value && !eMail.value) { eMail.value = fName.value + '.' + lName.value + '@domainname.com'; } return; } // </script> </head> <body> <form name="myform"> First Name: <input type="text" name="fname" id="fname" onchange="suggestEmail();" /><br /> Surname: <input type="text" name="lname" id="lanme" onchange="suggestEmail();" /><br /> Email Address: <input type="text" name="email" id="email" /><br /> </form> </body> </html>
  16. Good catch, but instead of running that inline Javascript line a better approach would be to run the function provided onload of the page.
  17. First you need to resolve the problem of the date being written correctly. Have you verified that you are returning the value correctly from the database? I expect not based upoon your results. Try this to make sure you are using a legitimate value: <span id="countdown1"><? echo date('Y-m-d H:i:s \G\M\TO', $endProductionTime); ?> </span> <br />Raw Date/Time from DB: <?php echo $endProductionTime; ?> As per your second item of a start date you still disn't answer my questions. I'm not sure how the start date/time has any relevance on what the count down time would be (unless the start date hasn't occured yet.) Please prove EXPLICIT details of how you want the start date to function. I can see several different uses for a start date. Here are the possible scenarios. Start Date & End Date are in the past: What would you want shown in this scenario? Maybe just the text "Complete"? Start Date is in the Past & End Date is in the future: Do you want to show the count down time using the script from the current time? If so, what is the purpose of the start date? Can't see how it would be used in this scenario. I guess you could show how much time has elapsed from the start date along with the remaining time. Start Date and End Date are in the future: What do you want to do in this scenario. Maybe just display the text "Not started" You are not providing enough information to provide help on the use of a start date.
  18. <html> <head> <script> function enableOther(selObj) { //Create reference to text field textObj = document.getElementById('other_manufacturer'); //Test select field value if(selObj.options[selObj.selectedIndex].value=='OTHER') { //Enable text field textObj.disabled = false; } else { //Disable text field & clear value textObj.disabled = true; textObj.value = ''; } return; } </script> </head> <body> <form name="myform"> Manufacturer: <select name="" id="" onchange="enableOther(this);"> <option value="Manufacturer 1">Manufacturer 1</option> <option value="Manufacturer 2">Manufacturer 2</option> <option value="Manufacturer 3">Manufacturer 3</option> <option value="Manufacturer 4">Manufacturer 4</option> <option value="OTHER">Other</option> </select><br /> Other: <input type="text" name="other_manufacturer" id="other_manufacturer" disabled="disabled" /> </form> </body> </html>
  19. The script counts down or up based upon the date you pass it. If it is counting up then the date you are setting is in the past. Look at the rendered HTML to see what is being written to the page. What EXACTLY are you wanting to do? Are you just wanting to displya a different start date on the page or are you wanting the countdown to start at a different date/time If it is the latter, EXACTLY how are you wanting that to work. For example, if the start date was set to June 1st and the end date is June 30th, does the page not show any countdown activity if accessed prior to June 1st? Need more info. Also, if there is anything else you aere going to request on this post do it now.
  20. There are several solutions to your problem and I expect each of them will require you to learn some new things. Here are a few possibilities 1) Get a 3rd party, server-side utility that will allow you to "point" the utility to the web page in question and output a PDF of the page. This would probably be the simplest solution, but it will cost money and the format of the PDF will look just like the HTML page (unless you provide code to handle the page differently for the PDF creation). Personally I would think the PDF should be constructed differently than the HTML representation. This would require installation of the 3rd party app. If you're on a shared server this may not be possible. 2) Use PHP's built in PDF creation functionality: http://us2.php.net/pdf This will require you to learn all the ins and outs of this process. It will probably take the most time, but you will get the most personal benefit from it. And it would be free. This requires that this functionality is enabled on the server. May be an issue for a shared server that you do not control. The link theonlydrayk posted above appears to be a Class that utilizes PHPs built in functionality but makes the process easier to implement. See comments below. 3) Implement some other 3rd party tool for PDF creation. This can be various implementation such as creating raw PostScript code and distilling it on the server using Adobe product or other tools (e.g. Active PDF). Or it could be something proprietary. This will give you the greatest amount of flexibility. But, it will cost money and will bethe most difficult to master. This would require installation of the 3rd party app. If you're on a shared server this may not be possible. I think #2 is what you want. The "Hello World" example is just that - an example. You would want to create your own code to have the dynamic content from the database used instead. Since we don not know your content or how you want it output, you are on your own at this point.
  21. You shouldn't need to edit the JavaScript, just output the database date in the correct format. Not sure from your post if you are using the text within the SPAN above to set the countdown date. If you are, this should work based upon what I see the Javascript functions expecting <span id="countdown1"><? echo echo date('Y-m-d H:i:s \G\M\TO', $dateFromDB);</span>! Output will be like this: 2009-05-26 15:05:46 GMT-0500
  22. That's a tough one, try this: http://lmgtfy.com/?q=ajax+tutorial On a serious note, I would highly suggest NOT using an IFRAME. There are just too many issues that I have encountered with them over the years. AJAX is the perfect solution for what you are wanting to do. Um, isn't that what the AJAX is doing? The JavaScript IS calling a PHP page!
  23. Please mark the post as solved.
  24. You should never use the same name for anything even if they are structurally different objects (e.g. a function and a field name). It will only cause confusion even if it does work. In any event, the second block of code should work - at least it did for me when I tested it with a field and function named the same (both IE & FF).
  25. My "example" was just that - an example. The logic still holds true no matter what method you are using to generate the output. I still contend that the most appropriate method of solving this issue is with modifying the code that generates the output not in manipulating the data. If you were to provide the code used to generate the output then we could take a look at modifying that. But, if the code is a completely self-contained 3rd party function it may not be worthwhile to do so and modifying the data may be the most "efficient" solution - while not the optimal solution.
×
×
  • 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.