Jump to content

jeffman

Members
  • Posts

    7,761
  • Joined

  • Last visited

Everything posted by jeffman

  1. You will find PHP syntax very similar to C and javascript. A number of built-in PHP functions, like strlen and array_push will also seem very familiar. There's a lot to learn, but when you go looking for some basic things, there's probably a version that sounds like what you already know. PHP is a lot like classic C with OOP support. 3rd party libraries tend to be OO. The online manual is one of the best development resources of its kind. In contrast, I personally find Microsoft documentation inscrutable.
  2. Your page already has a style sheet. Put it there.
  3. Alternatively, switch all the CSS and jQuery to element selectors. (Stuff like ul ul.) That way, if you need to add more submenus, you won't need to change the code. Most menus I've seen work that way.
  4. Assuming your CSS looks like this: .subcss { display: none;} change this $('ul>li').slideDown(); to this $('.subcss').slideDown();
  5. You should post the code leading up to the function call. I suspect something there is failing and the function isn't really getting called at all.
  6. Assuming I've pictured your idea clearly, I would do it like this. I'd want the two images to behave as a unit, so that other content could be placed next to it. So I'd put them both in a div, and limit the dimensions of the div to the exact dimensions of the combined images. Set the display property of the images to block so that one falls below the other, and also so that there is no gap between them. If the images are embedded in <a> elements, they should display as blocks also. HTML <div id="buttons"> <a href="destination1"><img src="flag1.jpg"></a> <a href="destination2"><img src="flag2.jpg"></a></div> CSS #buttons { height: 256px; width: 128px;}#buttons a { display: block;}#buttons img { display: block;} If you need to display content to the side of the images, apply the float property.
  7. Remember there are two different kinds of table cells to play with. There is the big table cell on the left in table1. There are also the table cells in table2. With this -- .table2 td {vertical-align: top;} the content of the cells in table2 lines up no matter how many <p> elements are in each. Changing the vertical-align of .table1 td doesn't affect that. You can tweak other positioning with padding.
  8. Can you show the relevant HTML and CSS? There are several ways this can go right, and a lot more ways it can go wrong. Probably, the elements are still displayed inline, so they behave like letters with spaces between them. I sure hope you're not using a <br> element between them.
  9. If we could "fix" this problem, what would the result look like? What would you like it to look like?
  10. I would only caution you to check the results in as many browsers as possible, including IE back to v8 or even v7 if you can.
  11. Please don't use relative positioning for indentation. Instead, set the margin and padding for all ul and li elements to 0px. Then correct one or the other (usually padding) for specific selectors. The reason is that different browsers create the indentation in different ways. Note that you can also control (in a general way) where how the bullet is positioned.
  12. The easiest thing would be to Google "jQuery slideshow". You'll need to download or link to the newest jQuery library and download a plugin library that interests you. jQuery is not easy to learn, but for a lot of these you don't need to learn very much. The real set up is the way you organize your HTML. Any javascript you need can usually be copy/pasted with few changes right from the plugin's homepage. That said, a slideshow is a very good project for teaching yourself javascript. If you show us what you've tried so far, we can help out. If you haven't even started, I would suggest learning how to do this: in a fresh document, put a button and an image. Click the button to execute a function that changes the src attribute of the image. That's not your slideshow, but you'll learn some basic skills that you'll need.
  13. Please choose. Are you going to use the inputs or an array? I've already explained how to use the inputs. If you want to store values in an array, then you don't need inputs, but you need a new kind of explanation.
  14. It's not quite what you think. Try this: <!DOCTYPE html><html><head><title>this and event</title><script type="text/javascript">window.onload = function () {alert(out.innerHTML);}</script></head><body><div id="out">Hi</div></body></html> I believe that's legacy stuff, and I don't like it at all.
  15. Play with this. Notice that you can use the same class names as many times as you want. You don't need special id's. <!DOCTYPE html><html> <head> <style type="text/css"> .slide { display: none; background-color: #ccc; width: 100px; } </style> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> </head> <body> <p class="trig">Slide</p> <div class="slide"> <div> <p>stuff</p> <p>stuff</p> <p>stuff</p> <p>stuff</p> </div> </div> <p class="trig">Slide</p> <div class="slide"> <div> <p>other stuff</p> <p>other stuff</p> <p>other stuff</p> <p>other stuff</p> </div> </div> <script type="text/javascript"> $(".trig").click(function () { $(this).next().slideToggle("slow"); }); </script> </body></html>
  16. As you are using it above, out is simply a global variable. If you use it in a function without also declaring it with the var keyword (as you do in fn1) it will retain the global context. Any changes you make to it in fn1 will affect out globally. If you use the out identifier in a function and do declare it with the var keyword, it is a whole new variable, local to that function, and global out is left alone. I would not call that forgiving. It is entirely to be expected.
  17. Are you sure toggle() is the correct method? I thiink you may be using it incorrectly. I also think maybe slideToggle() is what you want. I'm not really sure what your other question means.
  18. A single var keyword can initialize an arbitrary number of variables as long as they are separated by a comma. At the same time, you can set an initial value for any of them. In this case, only the second variable is being initialized to a value.
  19. In IE, some things require a doctype in order to work. Try making this the very first line of your document, I mean absolutely at the top: <!DOCTYPE html>
  20. That's actually a neat trick. I'm sure some purists will have a philosophical quibble or two, but I wouldn't worry about that.
  21. Post #5 is a double post. I've begun answering it here. I think OP's thread is still active.
  22. This is basically OK. Your goMad() function needs work. These statements are all fine: var inputs = document.getElementsByTagName("input"); // the statements I deleted are not finevar div = document.getElementById("story");div.innerHTML = story; inputs is a collection, which works like an array. You can loop through it if you like, or you can access the elements directly, using an index, like this: inputs[0]. It looks like you were trying to do that with your words variable, but words is not a collection or an array, so it won't work like that. The way you tried to build your story variable is almost correct. A text input does not have a "words" property, so forget about that. You can find the text in the input in its value property, like this: inputs[0].value That should be all the information you need to fix your function. (Please do not double-post in the future. )
  23. Start with CSS position: fixed If you want the widget that moves a little and then bounces back, Google "scroll follow"
×
×
  • Create New...