Jump to content

jeffman

Members
  • Posts

    7,761
  • Joined

  • Last visited

Everything posted by jeffman

  1. Because the JavaScript property is className not class.
  2. Do you actually have these HTML-style comments in your CSS? If so, that could do it. <!-- A LINK -->
  3. The case of your file names doesn't match the case of the names specified in your document. Look at the ".jpg" extensions. FWIW, you should enclose the src attribute of your image tags in quotation marks. It's not causing this problem, but rules are rules.
  4. The basic idea is that an element's appearance is controlled by CSS. JavaScript can change CSS values, so that makes animation and transitions possible. Javascript also has two built-in timer functions; these allow transitions like fade-ins to happen. To make it all work, you need to know a fair amount about JavaScript. You can find JavaScript libraries very easily. They can simplify the tasks, but you still need to know basic JavaScript. I recommend finding a library that does not require using jQuery. That will limit your choices, but you probably don't want to learn about JavaScript, CSS, and jQuery (all three) just to animate stuff. Unless you want to spend a lot of time on this. OTOH, I think you're going to spend a lot of time on this.
  5. In your example? Nothing. But notice that the second can be clarified a little like this: echo ($gender == 'male') ? 'Hi Sir!' : 'Hi Mam!'; That is, someone else reading the code (including you 2 weeks from now) can look at my example and know immediately that the statement will echo something. I also generally recommend that developers NOT write if-blocks without {braces}. It seems like it's not a big deal, but it can become a problem if you or someone else needs to add statements later, and you don't remember to add the braces. It happens to people all the time.
  6. I assume you want to do it yourself and not have someone write it for you. Here are some tips to get started. 1. you need two timeouts. The first rotates the images. It runs all the time. The second controls the image fade. It gets turned on by the first timeout and turns itself off when the fade is complete. 2. The thing you're changing is the CSS opacity property. You'll need to experiment with increments and intervals. 3. You need two images to occupy the same coordinates. The easiest thing is to have a div element with one image as its background. The div contains an image element. 4. You need two images because during the fade, both have to be visible simultaneously. You don't actually rotate the src until the fade is complete. The best you can accomplish with one image is fading one image out, changing the source, and then fading the next image in. You wouldn't get the cross-fade effect.
  7. jeffman

    Math editor

    I'm sorry. I really don't understand the question. I urge you not to use font tags, however. You can do the same job with spans and inline CSS.
  8. It's a Google API. I disapprove of the programming style, but it looks like OP is doing it right. I think. Anyway, I think the question gets answered like this: var feedArray = [ "http://www.dr.dk/nyheder/service/feeds/allenyheder", "http://feeds.feedburner.com/d0od?format=xml", "http://www.engadget.com/rss.xml", "http://feeds.newzmedia.dk/c/32893/f/582669/index.rss"];for (var i = 0, len = feedArray.length; i < len; i++) { new GFdynamicFeedControl(feedArray[i], "rss" + i);} Now you can add an arbitrary number of addresses to the array without changing the rest of the code.
  9. 1. Everything in your script that is not in a function is executed as soon as your browser reads it. So those last two statements are executed immediately. 2. The first call to document.write happens while the page is still loading, so it writes text into the document. When it is called in the function, AFTER the page loads, document.write KILLS the current document and begins writing a new one. There is no way to change that. This is why very few programs use document.write. Use innerHTML exclusively if you want a dynamic report of the function's progress. 3. The best way to start all this is to provide a text input for the user to enter a number at a time of his choosing. (I mean, get read of that confirm-type stuff.) Add a button with its click event bound to the Factorial function. Look up event handling.
  10. It's almost right. Your script should come after the canvas element if you want to get a reference to the canvas element in the global namespace. (It's probably better to get your reference to the canvas INSIDE the functions. Then your script can go in the head, where it belongs.) Also, you need to use the same CASE when you call the functions. myfunction and myFunction do not name the same thing.
  11. jeffman

    Math editor

    No one wants to waste time explaining things you already know how to do. Here are questions I wonder about. 1. Do you have a special font? Are the symbols available in Webdings? Will you use HTML entities to display the symbols?2. Do you know how to make a click handler?3. Are you using jQuery? (You don't have to)4. Do you know how to add text content to an element? A very basic technique might look like this, but I don't know if it's all you need: var sigmaButton = document.getElementById("sigmaButton");sigmaButton.onclick = function () { var display = document.getElementById("display"); var sigma = "Σ"; display.innerHTML += sigma;} But this is not efficient. This technique requires a unique function for every button, but there are many ways to do it using just one function for all. Knowing which way is best would depend on how you want your HTML to look. So 5. How do you want your HTML to be structured? Do you already have HTML, or do you need someone to design that for you too?
  12. Ouch. Well, assuming you have access to PHP on your webserver and you want to learn it, you can get started here. It is possible to connect to a DB on your webserver or a remote host.
  13. A lot of detail about forms here. The tricky action takes place on your server. Do you know your way around your scripting environment?
  14. 0. Turn on error reporting and temporarily remove the @ symbol from your call to mail() so you can get some error information. 1. Try sending a message with very simple values to make sure mail() even works on your system. 2. Try commenting-out (going around) your foreach structure to see if something in there is weird. 3. Try echoing the values that you are passing to mail() to see if they make sense.
  15. This is one statement that declares and initializes two variables. Compare: var a;var i = 0;var s = "Hello"; To save space and a VERY small amount of computing time, that can be simplified to this: var a, i = 0, s = "Hello"; Because JavaScript ignores most line breaks, the code you showed could be written like this: var object = {'foo': 'bar'}, num = 1; Which is the same as this: var object = {'foo': 'bar'};var num = 1;
  16. The problem is that you're going from margin-top: 15px to margin: -1px. You're experiencing a 16px movement. So don't use the margin trick for this. You already have the right idea by giving .hover_select a transparent border. What you haven't done is given the border a dimension. So in effect it doesn't have a border until the :hover. So simply give the transparent border a 1px width. In the :hover state, change only the border's color.
  17. jeffman

    @media print

    1. Always force a page break before the table. or 2. With JavaScript, do some math and force a break before the table only if the table is too big for the rest of the page. I've never tried any of this, but those are the first things I'd look into. I'll add that when I have set widths and margins on printed documents, I get irregular results, depending on the printer. YMMV.
  18. 1. getElementsByTagName returns a collection, not an element. To access a member of the collection you need an index, like an array index. If you know the index, then its easy. If not, then you need to loop through the collection and search each item for another distinctive property. 2. I'm pretty sure getAttribute returns a single attribute, not an attribute of an attribute. This will work if you want the backgroundImage of the first <tr> : document.getElementsByTagName("tr")[0].style.backgroundImage;
  19. jeffman

    jQuery $.get()

    Maybe you meant this: $_SESSION[$id] = "[$top,$left,$id]";echo $_SESSION[$id]; Back in JavaScript, you'll be able to pass that string to JSON.parse()
  20. Read about setTimeout and window.close NOTE that you can only close a window if you open it yourself. If the user opened the window, your script is not authorized to close the window. This is basic security.
  21. jeffman

    Annoyed

    If you don't include IE 7-8, the differences are fewer than you might think. For IE 7-8, there are some tricks you need to learn, starting with the use of a strict doctype.
  22. That seems very complicated. I will assume there is a maintenance advantage to keeping the English text and the French text in the same document. A strategy I would try is to embed the English version AND the French version of each text item in the HTML itself. Then assign a different class to each version. Something like this: <h1 class="english">Welcome!</h1><h1 class="french">Bienvenu!</h1> Your CSS would look like this: .english { /* stuff */ <?php if ($_SESSION['lang'] == "fre") echo "display: none;"; ?>}.french { /* stuff */ <?php if ($_SESSION['lang'] == "eng") echo "display: none;"; ?>} Yes, you would output a lot of text, but compared to an image, text requires very little bandwidth. You would also need to embed very little PHP in the HTML.
  23. FWIW The code DOES listen for the onchange event of 3 select elements. One possible problem is that the event handler accesses the value of the text input whether there is anything there or not. I suspect this is why OP initializes the value to "" in the input tag. OTOH, when I run OP's code I do not experience problems. If there is text in the input, it gets assigned to the variable. I assumed the problem was solved yesterday. I've only tried it in FF, but I haven't noticed anything unusual that would trip up a different browser.
  24. jeffman

    this.value

    'value' is not a normal property of a div. In such a situation, this should work: this.getAttribute('value') Unfortunately, it will not validate. If that matters, there is a way to create custom attributes: <div data-value="1" ondblclick="createWindow(getAttribute('data-value'))" class="button"></div> Any attribute prefixed with data- should be honored and will validate as good HTML. Disclaimer: I don't know if all browsers implement this yet. It's a technique I don't use myself.
  25. If you have the GD library installed, PHP can do it. There are also some 3rd-party libraries specifically for graphing.
×
×
  • Create New...