Jump to content

janroald

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Everything posted by janroald

  1. That solution won't do it for me, but thanks for your try, fenway. The whole point here is to go through the entire table without referring to anything but the table id. I'll look for a good way to get the rows without recursively adding inner table rows, and post it here if i find it.
  2. Sorry, I wrote wrong. It is of course the outer table rows im interested in, not the inner. The table layout above is just a constructed example. The actual table may have one or more nested tables inside. I need to traverse only the outer table rows.
  3. html : <table id="data" border="1"> <tr><td></td></tr> <tr><td><table><tr><td></td></tr></table></td></tr> <tr><td></td></tr> </table> js : mytable = document.getElementById('data'); mytablebody = mytable.getElementsByTagName('tbody')[0]; myrows = mytablebody.getElementsByTagName('tr'); alert(myrows.length); // This way myrows contains all tr's including the row in the inner table. Is there a good way of getting only rows from the inner table?
  4. Better example of what i'm trying to do. (of course, this dont work) // pass a url like ?this=foo&value=foobar $foo = 1; eval("\$bar =& \$$_GET[this];") $bar = 2; echo $foo; //2 Had a feeling this was a dead end, but had to try :-)
  5. No, not that easy :-) forget sessions, think just a simple variable $foo = 'bar'; // pass a url like ?this=foo&value=foobar How can i now, if at all possible, use $_GET[this] to create a reference to $foo and update it so that echo $foo; //foobar
  6. I'm trying to update session variables through ajax requests. I want to send the "name" of the variable over url and the value to give it. usual solution is to do a standard : if($_GET[this]=='that') { $that = ... } else if ...etc But i'm just trying to research the possibility to create a reference to an actual variable based on a string that tells me the variable name. Create a reference from a variable variable maybe... Sound any less confusing at all? :-)
  7. This one is kind of difficult to explain, but here it goes : Say $_SESSION[a] = 'true' Following url is of course invalid, but constructed to show my intention: index.php?name_of_variable=$_SESSION[a]&value_to_set=false; Is it possible to send a literal reference to a variable and then evaluate the reference so that i can update the variable without using its name?
  8. Try onselect instead. Obviously, your function never runs at all in FF. Your event handler isn't "handling" :-) Dont ask me why. <tr id='bankrow' name='bankrow' style='display:none;'> <select id='paidthrough' name='paidthrough' onselect="evaluate(this.value);"> <script language="javascript"> function evaluate(val) { alert("Hello"); if(val == 2) { document.getElementById("bankrow").style.display = "block"; } // else { // document.getElementById("bankrow").style.display = "none"; //} } </script>
  9. We are both reasonable people, i think :-) No "attacks" registered, nore any 'launched' :-) Just the typical forum/mail - problem, that people read too much in between the lines ;-) I try to write my lines so that they arent interpreted as either flaming or defensive, but I never seem to manage it fully. Maybe I should have picked a post where the code was in more need of attention than this one, and I apologise to the initial poster on behalf of me (and probably obsidian/destruction ) that we "hijacked" your thread with this discussion. I'll read your linked threads, obsidian, and there's probably lots of good concideration there. I almost cant wait, as i love theese discussions :-)
  10. Well guys, the intention by my post was not to flame, but to point out some of the "basics". In the example included, swapping double with single quotes did nothing else but to improve the coding. No added characters and a slight performance and readability gain. I simply feel it important to point out such things now and then, not only for the current poster, but for all that read the posts. I see no harm in this, only gain. Nowadays, php coding is, in my opinion, slipping out of control concerning coding standards. A large and complicated site/application written in php is doomed to end up badly written unless one starts to take small things into consideration. I see badly written code in this forum in most topics, and very few people that points it out for the writer. Though the code is not "incorrect" it's not good either. How about pinning a "coding standards"-topic if this is a forum for learning the basics?
  11. I can't think of a single good reason why u should use double-quotes. But by all means, it's not illegal.
  12. There are two ways to do this : when u make your form, you can also make an array containing the id's of the monkeys in the list, corresponding to the db id of the monkey. This array you can serialize, (http://www.php.net/serialize) and pass along in a hidden input field with a name of your choosing. When u submit your form you can unserialize the data from your hidden field and voila you got your array of id's to check for. The second way is to make a hidden field for every monkey row like this monkey01 <input type="hidden" name="monkey_ids[]" value="01" /> monkey02 <input type="hidden" name="monkey_ids[]" value="02" /> $_POST[monkey_ids] (if u use post method) will now contain an array with the monkey ids.
  13. And btw : echo " - ".$Field."\n"; Stop using " when u dont need it. Learn the basics before you start programming. When u echo with " ", php looks through your string for variables, hence works slower. echo " - $Field\n"; would give you the same result as above, but echo ' - '.$Field."\n"; will work faster, and is the correct way to do it.
  14. Two users cant share the same session. That would compromize security. You must use a database or a flat file to store the session data they should share, and load the data into their sessions whenever the data is altered. Some ajax would be advised to make such an application workable. Another solution would be to store the data in hidden fields on the webpage and ensure that the two users get the same page with the same data at all times.
  15. Hi, your needs are a bit too specific to point out a good cms for you. Usually you have to customize you cms to fit such specific tasks. http://opensourcecms.com/ This is a link to a site that lets you test online versions of most cms-solutions that's out there. The site also puts each system into cathegories, so that you know what tasks the cms is designed for. Happy hunting!
  16. janroald

    onmouseout

    Without knowing more than the info you supply, my best guess would be : because your background-image is on top of your background. <td bgcolor="#FF9900" valign="top" style="border: 2px solid #00003B" onmouseover="style.backgroundImage='url(hover-bg.jpg)'" onmouseout="style.backgroundImage='none';style.backgroundColor='#00003B'"> btw you should use this.style for browser compatibility, and also end your inline javascript with semicolon, just like you usually would in js. Same in inline css. <td bgcolor="#FF9900;" valign="top" style="border: 2px solid #00003B;" onmouseover="this.style.backgroundImage='url(hover-bg.jpg)';" onmouseout="this.style.backgroundImage='none';this.style.backgroundColor='#00003B';">
  17. html [code] <div id="foobar" style="display:block;">Some text to be hidden or displayed.</div> <br /><a href="javascript:show_hide('foobar','block');">Show/hide</a> [/code] js [code] function showHideDiv(id,style) {     var element = document.getElementById(id);     element.style.display = (element.style.display == style ? 'none' : 'block'); } [/code] This should cover your needs and get you started. Remember to give the div a display:block or display:inline or else you will have an extra click to make things happen.
  18. [quote]Whats the best way to ensure your web page looks consistent in both browsers?[/quote] Answer is KISS Keep It Stupid Simple There's now easy answer to your question. Solutions and workaraounds are always possible. Keep in mind that problems are usually met when u use div's for positioning/layout. If u can't solve it with divs, use tables. Be careful when u use paddings and negative margins, its a sure way to hell.
  19. Just add inline padding like this : <select multiple size="5"> <optgroup label="something"> <option style="padding-left:3px;">foo</option> </optgroup> </select> or you can do something like this <select multiple size="5"> <optgroup label="something" class="custom_padding"> <option>foo</option> </optgroup> </select> and in your css write : optgroup.custom_padding option { padding-left:3px; } That will affect all your <option>'s
  20. Again, Daniel, you should read the posts :-P Think he's looking for another form of masking than you think of.
  21. Here too :-) but you still had a couple of minutes when you wrote your solution :-)
  22. Thought you were just trying to get to 1500 posts before midnight, lol :-P
  23. Yep, you can use javascript and check for number of characters inputed every time the field changes or a key is pushed, and then add space or '-' or ':' as the next delimiter in the field. With a little hassle you can also have a default '__ __ __ __' or something in your field, and update how it looks after each time they enter something. But, no, there is no easy or built-in way to do it.
  24. Are you just repeating everything i say in all threads now? ;-)
×
×
  • 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.