I'm doing a very simple expand/collapse function using 'slideToggle'. The button that triggers this event simply says 'Expand/collapse'. I want this text to change depending on whether an element is visible or hidden.
if the dt-element in one of the definition lists has a specific css-property (e.g. length > 100px) then the dd-element with the css-class "subtitle" in the same definition list should be removed.
I would like to be able to test if an element already has a style applied to it. This style might either be an inline style, or come from a stylesheet. I'm writing a plugin which needs to apply a CSS style to an element if it's not already there.
I've been having this issue with Javascript that is just not getting resolved for a while. What I am basically doing is building a simple web browser extension that injects javascript on certain pages. I am using Firefox, Chrome and Safari. The issue I am having is accessing these so called "special properties" on a particular page. They look like the regular classNames, id, textContent and such but don't appear to be standard. It would be very helpful if I can access them.
A particular example would be in Yahoo Mail. When you are in your inbox you have list of messages. With each message row there are associated attributes. You can get to them with your web inspector or if you search for the div element with id "PagedTableView_wrapper", then follow the first child and then second child and you get a list of these messages being rendered. Each one of those rows has the regular className properties and such but also has "_checked", "_focused", "_selected" that look like custom Yahoo ones. I basically want to read those.
The issue is I can't. I always end up getting a null exception, as if it doesn't exist. I can read the className and the other standard ones fine, but not the special ones. (I've verified its the same element as well). I have tried the DOM navigation route with indexing, jQuery and XPATH, all with the same result. The weird part is that I can see them with the webInspector! Whats even more strange is that if I run firebug or commands in the Console, it actually works! But it doesn't work for my injected code/extension! Baffled.
I have developed a script that change the font size in css, but only the attribute "font-size" on the body tag, not change the entire active stylesheet.
When i click to change the size <a href="#" title="Change Font Size" onclick="cambia_font_size(2);">A</a>
It works fine, but when i try to check the cookie to set the default font size, it does not work.
The cookie stores the value correctly and i can read the value. The problem is when i try to change the value: document.getElementsByTagName("body")[0].style.fontSize=tam;
I have tried also writing this code at the end of the html document but it doesnt work <script type="text/javascript">inicializa_fontsize();</script>
I have a JS script that presents a series of "pages" with different questions inside a single HTML file, by rewriting certain <div>s. I have an object like this that contains the questions and information about answer labels etc (the idea is that this should be easy to modify for someone who doesn't know JS):
I have this simple manual photo slide show. It shows four photos and when you click the next button and it moves one photo over and one photo back for the previous button. I have to moving by changing the CSS property of 'left' by 195 pixels each move. So for it to move next it will subtract 195 pixels from the left property and for moving back it add 195 pixels to the left property. I have the code setup so when you click it changes the property of left to either -195 or 195 pixels but I need it so it actually does the math, not just give it a set value. But I don't know how to do that.code...
I have a bunch of input rows, each with id in the form of something like.. item:characteristics:age or item:setting:type1:blah. It's kind of like going down folders to get to the item I want. So as you can see in the code, I am splitting each id and trying to rebuild it in the form item[characteristics][age] then set it to the value of the input field. This is modifying the properties of the item. We already have the item object passed into my code and i'm simply modifying the properties to the new values from the user's input.
Does anyone know how I can do this without eval? I'm mainly using it because the variable name can't be hard coded, it is dynamic.
Basically, I have a bunch of input rows, each with id in the form of something like.. item:characteristics:age or item:setting:type1:blah. It's kind of like going down folders to get to the item I want. So as you can see in the code, I am splitting each id and trying to rebuild it in the form item[characteristics][age] then set it to the value of the input field. This is modifying the properties of the item. We already have the item object passed into my code and i'm simply modifying the properties to the new values from the user's input.
Does anyone know how I can do this without eval? I'm mainly using it because the variable name can't be hard coded, it is dynamic. Here's the code I have so far.
I am working on creating a simple image gallery. I have added styling around the thumbnail images (border and padding). I would like to change the border color when the item is hovered over. I know this can be done rather easily with the getElementById command. Can someone help me understand this process? Here's a snippet of the list that I am working with...
Here's the CSS:
ul { padding:0; margin:0; position:relative; } li { float:left; padding:0 .5em .3em .5em; list-style:none; } #gallery { list-style:none; } #gallery li { display:inline; } #gallery li a img { border:1px solid #ccc; padding:3px; }
Here's the HTML:
<ul id="gallery"> <li><a href="path/to/image/large/" title="title/of/image/"><img src="path/to/image/thumb/" alt="title/of/image/" /></a></li> <li><a href="path/to/image/large/" title="title/of/image/"><img src="path/to/image/thumb/" alt="title/of/image/" /></a></li> <li><a href="path/to/image/large/" title="title/of/image/"><img src="path/to/image/thumb/" alt="title/of/image/" /></a></li> </ul> I would like to change the border color from #ccc to #3455ef when the item is hovered over, and ideally have a different style when the item is clicked (or active).
I ended up having to preset style with JavaScript.
Here is what I did.
CSS Code:
JavaScript Code:
HTML4Strict Code:
The first time I hit toggle, nothing happens. The second time I hit toggle, the hidden list appears, but only because I used JavaScript to set the display property.
My workaround is to do this in the HTML after the element to be toggled.
JavaScript Code:
Putting this code in the elements onload event property didn't work either, which I found odd, but I read that it was not the recommended way of doing this.
I can't figure out why the CSS declaration didn't load into the JavaScript HTML DOM. I suspect it's some sort of order of execution thing, like the difference between the two following function declarations.
I'm writing a script that dynamically generates a menu table. Each TD has an onclick property which serves as a link. Everything works properly in other browsers since setAttribute onclick works. However, this function does not work in IE, and you're supposed to do this instead: elementName.onClick = "blah";
Here's my code that works in all browsers but IE: Code: var truePath = "document.location.href=" + "'" + "/" + urls[i] + "'"; cell.setAttribute("onclick",truePath); cell.onclick = truePath;
For IE, if I set the cell.onclick value to truePath, nothing happens when I click on the menu. However, it works fine in Firefox and Opera because of the setAttribute function. How I could get this to work in IE? My script is complete besides this part... I hate IE. Why can't they follow the rules?
I have several tags on a webpage of the same class. If the user clicks a specific checkbox I'd like to be able to alter the display property of the class, affecting all objects of that class.
This is an intranet application so we know that javascript will be enabled and the browser will be IE.
How can I affect all the members of this class? Is there a way I can toggle the DISPLAY property of a class so all the elements using that class would be affected? Code:
I'm looking for a way to add or change a property value in a previously defined CSS class - not just HTML objects that have that class. Then if later objects are assigned with this class, the objects would inherit the properties of the updated class. For example, if I change the class "image" to add "display:none", and then add the "image" class to an object, it would be displayed or not displayed depending on how this was previously defined.
The script is working, tab-content is changing but when clicked a tab I want to change class property of the li of active tab as class="current"How can I do it
I am trying to select a div element based on its display property. Due to some reasons I can't use Id to select this element, DIV element is structured like this:
I'm having an issue retrieving the height() / outerHeight() property of a div element that has an img as child. This happens only on chrome and safari. Here's an example: [URL]
I'm attempting to change the display property of certain divs depending on the criteria of multiple select boxes.
I got it to work by GetElementsByTagName('div') but it then selects all divs rather then the select few i actually want it to work on. I tried changing the selection to GetElementsByName but this doesn't work, why i don't really know.
I am trying to use Javascript to change the CSS property fontSize to increase over a small amount of time. Here's the code:
Code: function iscalled(id) { changesize(15,25,id)
[Code]....
I want to have the font size dynamically change, in the (id) object. I experimented with several versions of setTimeout, because it wasn't delaying at all. This script will run through setattr() only twice and doesn't modify the font size.