Jump to content

codefossa

Members
  • Posts

    583
  • Joined

  • Last visited

  • Days Won

    1

codefossa last won the day on March 23 2013

codefossa had the most liked content!

About codefossa

  • Birthday 04/19/1992

Profile Information

  • Gender
    Male
  • Location
    Ohio, United States
  • Age
    23

codefossa's Achievements

Member

Member (2/5)

27

Reputation

  1. The required attribute is being used on your file select. Remove that and it will become optional.
  2. If you're getting them ready to send to another page, you could check out serialize() for the form. Give each of the sets of checkboxes a different name and they'll be set up and separated for you to deal with in PHP. On a side note .. This is Javascript. Java is so completely different that it has absolutely nothing to do with anything here.
  3. You can check this out: http://xaotique.no-ip.org/tmp/17/ View the source and you should get your answer. If you have any questions, feel free to ask, but please use a code box because I don't feel like bothering to look through plain text.
  4. Please use code tags when you show any code. It makes it much easier to look through. Without changing a whole lot of your code .. Demo: http://xaotique.no-ip.org/tmp/28/ <html> <head> <script language="javascript"> window.addEventListener("load", function() { window.document.frmname.addEventListener("submit", function(e) { e.preventDefault(); var str= ''; if (document.getElementById('name1')) { if (document.getElementById('name1').value == '') { alert('Cannot be left Blank'); document.getElementById('name1').focus(); return false; } } str = "Short1.php"; document.frmname.action = str; document.frmname.submit(); }, false); }, false); </script> </head> <body> <form name='frmname' method='post'> <input type="text" name="name1" id="name1"> <input type="text" name="name2" id="name2"> <input type="text" name="name3" id="name3"> <input type="submit" value="shorten"> </form> </body> </html>
  5. So you want each number for each of them or what? That would be a ton of lines. I don't really see what you're trying to do.
  6. Assuming you can just create the links, here's an example. Demo: http://xaotique.no-ip.org/tmp/27/ Javascript window.addEventListener("load", function() { var img = [ 250, 500, 800, 1000 ]; var btn = window.document.querySelectorAll(".btn"); var txt = window.document.querySelectorAll(".txt"); btn[0].addEventListener("click", function() { var input = txt[0].value.split(', '); txt[1].value = ""; for (var i in input) { var num = [ input[i], input[i].substr(0, input[i].length - 3) + "000"]; if (i > 0) txt[1].value += "\n"; for (var n in img) { txt[1].value += "http://www.mysite.com/file/folder/blah/" + num[0] + "/_something_else here/" + num[1] + "/image" + img[n] + "\n"; } } }, false); btn[1].addEventListener("click", function() { for (var i in txt) { txt[i].value = ""; } txt[0].focus(); }, false); }, false);
  7. What does the date come out as for the value of v2? (show it to me as a string)
  8. Show an example of the URL and say what you want out of it?
  9. You would float all three of them left and it would work. The only way it won't work is if you got the dimensions wrong or something.
  10. Check out Ajax and jQuery makes it so much easier. I don't have time to link to a bunch at the moment but check out $.post() and $.load().
  11. I'm gonna play Santa, just because I was bored. Demo Page: http://xaotique.no-ip.org/tmp/26/ HTML <table> <tr> <td class="link">New Word</td> <td class="desc"></td> </tr> <tr> <td class="link">Translation</td> <td class="desc"></td> </tr> </table> CSS table { text-align: center; } .link { color: #000077; } .link:hover { cursor: pointer; } .desc { color: #252525; text-align: left; } Javascript // Allow the page to load first. window.addEventListener("load", function() { // Function for generating random numbers. function random(from, to) { return Math.floor(Math.random() * (to - from + 1)) + from; } // Array of words and their translation. var words = { 'king': 'kong', 'ele': 'phant', 'drag': 'on', 'php': 'freaks' }; // Array of our link class. var links = window.document.querySelectorAll(".link"); // Cycle through the array. for (var i in links) { // Set an onclick function. links[i].addEventListener("click", function() { // New word or translation? if (this.innerHTML == "New Word") { // Clear and set new word. window.document.querySelectorAll(".desc")[1].innerHTML = ""; window.document.querySelectorAll(".desc")[0].innerHTML = Object.keys(words)[random(0, Object.keys(words).length - 1)]; } else { // Show translation. window.document.querySelectorAll(".desc")[1].innerHTML = words[window.document.querySelectorAll(".desc")[0].innerHTML]; } }, false); } }, false);
  12. I use Geany as well. A very lightweight, free IDE and has plugin support for a few missed features. Also available in Ubuntu repos. (:
  13. <?php $site = 'http://example.com'; $wait = 2; // Seconds ?> <meta http-equiv="refresh" content="<?php echo $wait; ?>;url=<?php echo $site; ?>" /> You're being redirected to <?php echo $site; ?>.
  14. Okay, so there's no key to call on, therefore I'm assuming you want to loop through them all. What I don't understand is why you would use an array within an array making the inner array the first item of the outer array, which is pointless unless there's multiple arrays in it. A more sensible array would be something like: $data = array( 'key1' => array(1, 2, 3), 'key2' => array(1, 2, 3), 'key3' => array(1, 2, 3) ); Then you could call on it by the key of choice (as it looks like you were trying to do by the previous posts). $data = array( 'key1' => array(1, 2, 3), 'key2' => array(4, 5, 6), 'key3' => array(7, 8, 9) ); $var = 'key2'; foreach ($data[$var] as $item) { echo "{$item}<br />"; } Outputs 4 5 6 Hopefully I'm correct on what you're trying to do.
×
×
  • 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.