Jump to content

jesh

Members
  • Content Count

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. jesh

    Absolute Positioning

    It's -10px because your image has a 10px margin on top. #display a span img {border:0 none;margin:10px auto;} If you got rid of the 10px margin, you should be able to set the top to 0 and have it align with the top of the UL.
  2. jesh

    socket coonection

    Now that's a great idea.
  3. That looks about right. The only thing to consider is if the date stored is actually more like "12/31/2008 12:11:05.5445 PM" then you're going to have a rougher go at it because that date is not equal to "12/31/2008".
  4. jesh

    socket coonection

    At least he's out of 2005 and into 2006. Maybe he'll catch up some day.
  5. jesh

    Absolute Positioning

    If you set the UL element's position (in this case we set it to relative so that it'll stay put where it is) then any child elements that are contained in there will have their positions set relative to the UL rather than the body.So, setting the "top" property to 0 for any absolutely positioned child elements of the UL will place those elements so that their tops align with the top of the UL.Does that help explain it?
  6. jesh

    Absolute Positioning

    You might try this: #nav ul { width:250px; height:150px; list-style:none; margin:0; padding:0; position:relative;}#display a:hover span {display:block;position:absolute;left:226px; top:-10px; z-index:5;}#display a:active span {display:block;position:absolute;left:226px; top:-10px; z-index:5;}#display a:focus span {display:block;position:absolute;left:226px; top:-10px; z-index:5; outline:0;}
  7. Also, according to the tryit section, it doesn't work in IE.http://www.w3schools.com/tags/tryit.asp?fi...tml_table_frame
  8. Many browsers don't like it when you set the display of a table cell (a TD element) to "block". You might try something like this instead: function hideshow(id){ var j = document.getElementById(id); if (j.style.display == "") { j.style.display = "none"; } else { j.style.display = ""; }}
  9. jesh

    Absolute Positioning

    When you position something, it is positioned relative to whichever parent container has its position set. Consider this example:<html><head><style type="text/css">div { width:300px; height:300px; background-color:#ddd; margin:2px;}div.two { position:relative;}a{ position:absolute; right: 40px; top: 40px;}</style></head><body><div class="one"><a href="#">LINK</a></div><div class="two"><a href="#">LINK</a></div></body></html> The link in div.one is positioned 40 pixels from the right of the browser window because div.one is not, itself, positioned. The link in div.two, however, is positioned 40 pixels from the right of div.two because it has its position set to relative.
  10. jesh

    Break Out The Frame

    My kind of documentation!
  11. jesh

    Casting

    parseInt(), if you are really looking for integers rather than floats, is even faster still:<script type="text/javascript">var start;start = new Date();for(var i = 0; i < 1000000; i++){ parseFloat(i,10);}document.write(new Date() - start);document.write("<br />");start = new Date();for(var i = 0; i < 1000000; i++){ parseInt(i,10);}document.write(new Date() - start);document.write("<br />");</script> About 4 times faster on my machine - 400ms for one million parseFloats and 100ms for one million parseInts.
  12. jesh

    CSS sounds

    I wonder if he's just going though the list in order, one topic at a time, and answering every question that never got sufficiently answered.This one is #1341: http://w3schools.invisionzone.com/index.php?showtopic=1341The next one he may look at is 1342, then 1343. Maybe we can beat him to the punch.
  13. When document.getElementById('x') says that it "has no properties", it's a really good indication that there aren't any elements in your document that have an id of 'x'.This is the error I get in Firefox: Looking through your HTML, I see that you have a span in there with an id of "manager", not "Manager". You might try modifying either the id of that span to be "Manager" or the javascript to be document.getElementById("manager").
  14. I was always under the impression that Math.random goes from 0 to <1. The following test, run ten times to get 100,000,000 random numbers, never once produces a 1 (which would attempt to increment an element in the array that doesn't exist): <html><body><script type="text/javascript">var output = [0,0,0,0,0];for(var i = 0; i < 10000000; i++){ output[Math.floor(Math.random()*output.length)]++;}document.write(output);</script></body></html>
  15. You can add a hidden input that stores your random number and populate it on page load:HTML: <input type="hidden" id="randomnumber" name="randomnumber" /> java script: function randomNum() {document.getElementById("randomnumber").value = Math.floor(Math.random()*1000000);}window.onload=randomNum; EDIT: Also, as far as I am aware, your random number algorithm will produce numbers between 0 and 999,999 rather than 1 and 1,000,000.
  16. jesh

    Link Images

    text/javacript should be text/javascript.
  17. jesh

    New Version

    Yeah, you'll probably want to prevent that at some point:http://www.jarrettcode.com/?enterN=%3Cscri...);%3C/script%3E
  18. You can use the font-weight property of CSS. If you want to style all links to bold, you can do something like this:a { font-weight:bold; } If you want only links that have a class of "special" to be bold: a.special { font-weight:bold; } Check out the tutorial: http://www.w3schools.com/css/css_font.asp
  19. jesh

    Ajax With Utf

    Yeah, good luck. The only thing that I really see that is different is that you mentioned that the JSON.stringify script unicode-encodes the data before sending back the response. Maybe there's some weird double encoding happening. In our application, we just pass the strings around as-is with no extra encoding going on anywhere.
  20. jesh

    Ajax With Utf

    I mentioned in the SQL forum that in our application, the page that responds to the AJAX request explicitly sets the Content-Type header to:
  21. jesh

    Sql Server 2000 Utf

    I realized that there was a place on our site that uses AJAX to fetch the data back from the server where the response is a JSON string. When I look in Firebug at the response that comes back, the section of the data that is returned looks like this: \u003eÜberblick schließen über Befähiger Möglichkeits\u003c Where \u003e equates to ">" and \u003c equates to "<".Also, the Response Header has the following: Content-Type: application/json; charset=utf-8
  22. jesh

    Class'es

    It "doesn't work" because both of those styles conflict with one another. One sets the width to 500 but the other to 300. One sets the background color to green but the other to red. What does it mean to have a div that is both 500 pixels wide and 300 pixels wide?A more apt example would be like this: <html><head><style type="text/css">.isBigSquare {width:300px;height:300px;}.hasBorder {border:2px solid red;}.hasBackground {background-color:green;}.hasColor {color:yellow;}</style></head><body><div class="isBigSquare hasBorder hasBackground hasColor">HELLO!</div><div class="hasBorder hasBackground">WORLD!</div></body></html>
  23. jesh

    Xml Bug?

    Short of modifying your XML, you can modify your script. Rather than just getting all the child nodes and returning a count (or whatever it is you're trying to do), you can get all the child nodes and then iterate through them, look at the nodeType, and only count the Element nodes.
  24. You can execute multiple pieces of code in those handlers, just separate them with a semi-colon: <input type="checkbox" name="Box" value="0" onclick="this.form.text1.disabled = !this.checked; if(this.form.text1.disabled == true) { this.form.text1.value = '0'; };" /> But, that quickly gets confusing. You're better off assigning a function to handle that event: <input type="checkbox" name="Box" value="0" onclick="disableBox(this);" /> And then defining that function elsewhere: <script type="text/javascript">function disableBox(cb){ cb.form.text1.disabled = !cb.checked; if(cb.form.text1.disabled == true) { cb.form.text1.value = "0"; }}</script>
×
×
  • Create New...