I cannot get Firefox 2.0.0.4 to reposition an object by changing the top of posTop attribute of the objects style. This workins in IE and Safari, but not Firefox.
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}
function ProposalInfoRollOver(id, obj) {
position = findPos(obj);
This is pretty straight forward... I want to change the cursor to the hand on a mouse event. This works just fine, if I use other cursors, but for some reason I can't get the cursor:hand to work in Firefox???
function displaySetter(value) { var parent = findParent(document, this); if (parent) { if (parent.tagName == 'TD' && value.toLowerCase() == 'inline' ) { value = 'table-cell' } } this.setProperty('display', value , 'important'); }
function findParent(obj, style) { var nodes = obj.childNodes; if (obj.style == style) { return obj; } for(var i = 0; i < nodes.length; i++) { var suBsearchResult = findParent(nodes[i], style); if (suBsearchResult) { return suBsearchResult; } } return false; }
As you can see each time I need to scan whole document for parent which I would like to avoid. Is there any other way to get an object on which style is applied to?
I thought I'd try to begin with the accordion and tab, but I have had no success yet. I must be missing something simple. Here is the first test page:[code]Instead of getting tabs, I get my pages (generated by cgi perl scripts) displayed in tiny little scrollboxes at the top left.Equally bad, Firefox is telling me, in the error console, that jQuery.Tabs is undefined.FireFox doesn't like the filter and zoom properties in your style sheet.So, then, what do I need to do to get the tabs to work in the first instance. And then, how do I modify it to use an Accordion to display the same material. Are there any issues I need to be aware of when I start having my perl scripts (using predominantly the Perl packagesCGI and CGI::Session)create these pages?As far as possible, I am trying to keep this all valid HTML5, so that I can eventually make this interface mobile device friendly.
My understanding had been that $.css("width") would return the original user selected style, eg "100%" or "10em", and $.width() returned the computed width, always in "px". Not so, following the code through for .css(), it calls something called getComputedStyle and the only difference between the two functions turns out to be a post-fix of "px" on the .css() result - not very useful. I need to know whether my user has called me with a proportional dimension, or a fixed one. How to tell with jQuery?
This is probably quite a simple problem but I can't figure out the answer. I'm working on a site that has news stories and events coming in. What I would like is to have the news stories to be styled with squares and events with discs for instance. I might be able to change the actual plug-in so the CSS affects this change, but I just wondered how I could change the list-style-type with jQuery.
if I have an html page that uses the <style> or a <link> to call a style sheet these properties aren't available to JavaScript is there a good way to access them? eg
<html> <head> <title>expandable text area</title> <style type="text/css">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript"> function TextScroll(scrollname, div_name, up_name, down_name, top_name){ [Code]...
When I use mouse wheel in Firefox to scroll contents of the DIV, memory usage in Firefox goes through the roof. Code above is a fully working page, if anyone would like to see what's up, just load it up, and start moving your mouse wheel in the area with text. You don't actually have to scroll the text, just moving the wheel back and forth in that DIV will do. Memory usage will start going up quite fast, and after you stop moving the wheel, it will finally come down a bit after a short while. I've highlighted in red the line where mousewheel event is registered for Firefox. I'm not sure if it's really a problem, but since Opera and IE don't have any strange memory usage, and Firefox does, maybe I did something wrong. In everyday use it shouldn't matter [don't expect to have kilometers of content to scroll], but anyway, it is a bit unsettling.
if ((window)&&(window.netscape)&&(window.netscape.security)) { // OK, this is Gecko/Firefox or someone mimicing it so well // that there is no way to catch it on the act. }
But I need Firefox *1.5 or higher* or another (but sure) way to know that this browser has native SVG support. Here I'm stock.
It seems there is window.navigator.productSub and on my Firefox 1.5 it's 20051111
But I'm not sure: this "build version" is going up guaranteed or it's random like CLASSID? Also is the same Firefox release has the same build for all platforms or not? mozilla.org seems silent.
I found that if I define the style(visibility...) of a Div in a CSS class, I wouldnt be able to set it through JavaScript. The only way it works is if I declare all the style attributes in the Div tag itself first. Is this how it works?
What I wanted was to get rid of offsetLeft and use "proper" way instead....but when I do:
document.getElementById('someDiv').style.left; I keep getting empty string, unless I first set it manually (in CSS or js) to some value...
if that is intended behavior(that is if I haven't f***d up something :) in my code), and there is no offsetLeft property in W3C recommendation, what is then "standard compliant" way to make browser calculate coordinates of some tag on the page???
If I didn't set the height of an html element on a web page with html attributes. Then obj.style.height always reports "0" even after the page has completely rendered. Is there any way to get the actual height after being rendered?
If I code JavaScript as if it were C code with respect to the use of semicolons, are there any caveats? I understand that I will be typing a few more semicolons than absolutely needed.
how can I get/set text from <style> tag? innerHTML doesn't work in IE 7 (8?) and neither does document.getElementsByTagName("style")[0].firstChild.nodeValue = "";
I have the following function in my attempt to build a 'treeview' It should (and does in Firefox) display an indented <p> tag (css indents it). The problem however, it doesnt work in IE. When this function is fired IE builds a VERY small <p> tag without any content in it... I think the problem might by caused by style.display but I don't know how to solve it.
function r_treeview(test, path) { // get DIV element elm = document.getElementById(path); pid = 'sub'+path;
// add paragraph (p) to contains var test if (!document.getElementById(pid)) { var pTag = document.createElement('p'); pTag.setAttribute('id', pid); pTag.className = 'subp' pTag.style.display = 'block' elm.appendChild(pTag); pTag.innerHTML = test; } }
I know this is probably a really simple this to do, but for the life of me I can't figure it out. I want to find out the value of a style for a certain element. So say in the CSS I said 'content' had a width of 100px, but I want to get that value with Javascript.
I am trying to style a <tr> that is generated using innerhtml. I have tried giving it a class, an id, and styling it inline. Not sure what the deal is. If i try it with the <td> it works fine.