Jump to content

iwato

Members
  • Content Count

    1,496
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. QUESTION: How does one get the focus rectangle to disappear in Internet Explorer?BACKGROUND: I recently included the following script in my webpage in an effort to eliminate the focus box in Firefox when the user clicks on links used only for the purpose of revealing the contents of the title attribute upon mouse over. I have been told that this script does not work in IE8. I know that it works in the most recent versions of Safari, Opera, and Firefox.JS CODE:<script typt="text/javascript"> function onFocus() { if (this.blur) { this.blur(); } }</script>HTML SAMPLE CODE:<a href="#" onclick="return false" onfocus="onFocus()" title="Japanese equivalent" class="Text_Translation"><em>katakana</em></a><em>English equivalent</em></a>SOURCE PAGE: http://www2.gol.com/users/hsmr/emblem/name.htmlRoddy
  2. But why, I also misspelled a word.Roddy
  3. I have decided for the moment that it is not worth the effort . In any case, thank you for your kind effort.Roddy
  4. Hier ist das Problem das gedoppelte "t". Mach' aber weiter. Mir gefehlt es, ab und zu auf Deutsch zu schreiben.Roddy
  5. OK. I am now able to assign new classes to button objects with mouse events and change the appearance of buttons with the :hover pseudo class. This new knowledge makes me very happy. However, what I am unable to do is preserve the appearance of my buttons -- namely, the buttons' rounded corners. Short of using a JavaScript program like SVG-Roundies what must I do?The following pair of sample pages work together. Each uses a different approach to achieving the same button effects. Neither preserves the rounded edges of the button.SAMPLE PAGES: Mori and TennisRoddy
  6. This is good to know, and I always create my HTML pages with XHTML 1.0 Strict. But, what about invoking a different class? Is it alright to write: document.getElementById("SomeID").style.class="SomeClass"; ?Roddy
  7. So, I eliminated the name and replaced it with an id. It worked. Hooray and thanks! I hope the name was not important. . .Originally I tried to change the class of my button dynamically and use CSS. Unfortunately, I had never used the pseudo classes :link, :hover, :visited, and :active with anything but <anchor> tags.1) Can I really write input.SomeClass:hover? Will it work? I do not remember ever having seen how to change the appearance of a button using such a script. 2) Can I also write document.getElementById("SomeID").style.class="SomeClass"; ? Will this work? Yes, I have experienced this same phenomenon and have learned to guard against it by not pasting anything from another document until I have first changed the copied content into TXT format. It has already become a matter of habit, as it was the source of several mysterious errors elsewhere. W3C validation cured me of this problem very quickly.Roddy
  8. QUESTION: How does one change the appearance of an <input> tag -- specifically type="button"?BACKGROUND: The below set of code produces two error messages in Firebug: one going in and one coming out. At minimum, these errors tell me that I have targeted my button properly. What I do not understand is why Firebug is telling me that onHover() and mouseOut() are not functions.<head><script type="text/javascript"> function onHover() { document.getElementById("bottom_right").style.color="#FFF"; } function mouseOut() { document.getElementById("bottom_right").style.color="#FFF"; }</script></head><body><input type="button" name="bottom_right" value="Bottom Right" onclick="openWindow()" onmouseover="onHover()" onmouseout="mouseOut()"/></body
  9. Thanks, Deirdre's Dad. I substituted the text that you suggested and the result was the same. I still have not fixed the problem, but at least my knowledge of Javascript has increased.Roddy
  10. QUESTION: Could someone please explain the use of the slash and vertical bar in the following statement:if (/loaded|complete/.test(document.readyState)) return initfb();Roddy
  11. QUESTION: How does one get the return statement to return more than one value?BACKGROUND: The following code works great up to the point where I try to return the values of both bName and bVersion. Here is what I have tried:return bName bVersion; // Returns an errorreturn bName, bVersion; // Returns only bVersionUnfortunately, I need the values of both bName and bVersion, and I need them separately. Must I create an object? function getVersionNameAndNumber() { var patt1 = /\S+\/\S+/g; var bNV_String = navigator.userAgent; var bNV_Matches = new Array(); var bNV = new Array(); bNV_Matches = bNV_String.match(patt1); for (var i=0; i<bNV_Matches.length; i++) { bNV_Match = bNV_Matches[i]; bNV = bNV_Match.split("/"); var bName = bNV[0] var bVersion = bNV[1]; if (bName == "Firefox" || bName == "Opera") { return bName, bVersion; } else if (bName == "Safari") { for (var j=0; j<bNV_Matches.length; j++) { bNV_AppleMatch = bNV_Matches[j]; bNV_Apple = bNV_AppleMatch.split("/"); var bName_Apple = bNV_Apple[0]; var bVersion_Apple = bNV_Apple[1]; if (bName_Apple == "Version") { bVersion = bVersion_Apple; return bName, bVersion; } } } else {} }}document.write(getVersionNameAndNumber());
  12. Sorry for getting back to you so late, but your suggestion would have required an additional iteration that I was able to avoid with a different approach. Moreover, once the variable name were created I was not at all sure that the following would work:var varName[i] = "ith string of information"; Your comment in regard to the above code would surely be appreciated.Roddy
  13. QUESTION: How does one change the name of a variable iteratively?BACKGROUND: During an iteration I extract information from a string based on a matched pattern. This pattern repeats itself in the same string a different number of times depending on the string that is matched. With each occurrence of the pattern in the same string is associated new information. My goal is to capture this information and assign it to a uniquely identified variable. Because the number of times that the pattern repeats itself is neither known, nor fixed, the number of uniquely identified variables for each string is also unknown. I would like to produce the following sort of output:DESIRED ITERATIVE OUTPUT:varName1 = "1st string value";varName2 = "2nd string value";...varNameN = "nth string value";I have seen this done with movie clips in ActionScript, but can no longer find the reference. I remember the technique as being simple, but not particularly intuitive. Does someone know?Roddy
  14. iwato

    Casting

    var x = "123";var y = "xyz";x = parseFloat(x, 10);y = parseFloat(y, 10); Yes, I had forgotten about the parseFloat() method, perhaps because of its complexity and specificity to more sophisticated mathematical manipulations. In any case, as Ingolme explained, when making a comparison even strings are permissible. if (isNaN(x)) alert("x is not a number");else if (isNaN(y)) alert("y is not a number");else alert(x + y); So, why do you not use the try, throw and catch construct? My comparison, by the way, is made in just such a pattern, and it works great. You can use the same error message over.
  15. iwato

    Casting

    QUESTION: How does one convert a string variable to a number variable for the purpose of numerical comparison?BACKGROUND: In Flash's ActionScript it was possible to cast a string-type variable as a number-type variable to facilitate numerical comparisons. How does one go about this in Javascript?Roddy
×
×
  • Create New...