BackgroundColor Partly Updating?
Aug 18, 2007
I have written a javascript version of tetris and at every 10th cleared line, I change the body background color more towards red. However, the page only seems to update parts of the background. It is only after min/maxing the window or otherwise forcing a redraw that the whole page background is actually updated to the correct color.
Any idea why this is and if/how this can be fixed?
This line works as expected, but it may be relevant to highlight.
document.body.style.backgroundColor = "rgb(255," +GB+ "," +GB+ ")";
View 1 Replies
ADVERTISEMENT
Jul 23, 2005
When I set the background colour of an element using
tdRef.style.backgroundColor and then read it back, Firefox always
gives rgb(r, g, b) regardless of whether I've used rgb(...) or #rrggbb
to set it.
If I use tdRef.bgColor to set/read the value, I always get #rrggbb
regardless of whether I've used rgb(...) or #rrggbb.
IE, on the other hand, when using style.backgroundColor reports back in
whatever format was used (either rgb(...) or #rrggbb), but, like
Firefox, always gives #rrggbb for the bgColor method.
My question is which method is most consistent across various browsers?
I want to use style.backgroundColor (since some browsers don't support
bgColor, I guess it's a legacy from the ver 4 browser days). If I
decide to use rgb(...), is it consistently supported by other browsers
or do some report in #rrggbb regardless? Code:
View 1 Replies
View Related
Jun 26, 2006
I want to get the colour in HEX format using "thing.style.backgroundColor". Like "#FFFFFF" or whatever. IE gives this but FF gives it as "rgb(0,0,0)" format.
Is there a simple function/method of getting it as hex? (or a conversion function)
View 3 Replies
View Related
Dec 4, 2009
I have this php generated table
for ($i=0; $i<=count($mat)-1; $i++)
{
echo '<tr id="tr'.$i.'" class="table_body" bgcolor="GhostWhite"onclick="changeColor(this.id)">';
echo '<td width="150">'.$mat[$i][0].'</td>';
[Code]...
View 3 Replies
View Related
Aug 31, 2011
I would like to do things. 1) to change text in span to "" and 2) to change background of it.When I click on anchor, so "Saved!" with green backround will appear. And it would disappear after 1500 ms.
View 10 Replies
View Related
Feb 8, 2010
I'm trying to compare a <div> background color with another color. However, on FireBug, I noticed that my <div> doesn't have a background color code in it (I placed document.getElementById(o) on watch), even though I have already specified on my css. As a result, I'm comparing an empty string with another color code. Why is this so ?
Javascript:
function highlight(o) {
var color1;
color1 = document.getElementById(o).style.backgroundColor;[code].....
View 2 Replies
View Related
Nov 24, 2010
I need help with an IE8 problem. I want to give as many facts as possible.
Reference: [url]
I have already banned less than IE8 from my site but have the following problem with IE8 only (works on Mac and Win in these"allowed" browsers:Safari 5+, Chrome, FF 3.5+ and Opera 10+):
I use the backgroundPosition setter / getter extensively in this animation-extensive site.
But it breaks in IE8.
I did hack this as the only way I could get IE8 to work in a frame animation algorithm, noting that I have to test for browser and version (ugh) and then use this getter:
The following is an example that appears to work but seems unstable to me: (note that "accordionState"references an object within a data store attached to the "page" element):
There are many other cases where I have get or setbackgroundPosition,especially in the 'over' and out' functions where I use hoverIntent.
As a great fan and user of jQuery, I am puzzled that this will not work in IE8. Note thatbackgroundColor does not work either, although I do use UI to do these sorts of things and it seems to work in IE.
View 1 Replies
View Related
Aug 31, 2011
I have such code:
<a href='localhost' onclick='$.post("index.php?action=ax&save=1", { tname: "basic", rid: "3", col:"id", val:$(this).prev().val() } );$(this).next().html(" Saved!"); return false;'>Save!</a>
[code]....
View 5 Replies
View Related
Oct 5, 2011
There is a live search on my web page but the box of available options which falls below the 'input' field has a transparent background color. How can it be changed to non-transparent?This line below makes the background white, but all the text on the page shines through, since the default is transparent.
[CODE]
document.getElementById("linksearch").style.backgroundColor="#FFFFFF";
[CODE]
This instruction line does not help much 'cos I can't figure out the correct way to make it work:
[CODE]
View 22 Replies
View Related
Sep 23, 2009
i want to animate the backgroundcolor of the <body> when the page is loaded. It works - but sometimes when i switch from one page to another or if i just reload a page, it doesnt change.First i used this script:
<script>
$(window).load(function(){
$("body").animate({ backgroundColor: "#bdc58f" }, 1000);[code].....
But it doesn't make any difference - both are working generally, but sometimes if i load a page it doesnt change the color.
View 5 Replies
View Related
Apr 12, 2011
I would like to select all input elements on a page in which have a specific background-color.How would I go about doing that?
View 7 Replies
View Related
Jul 20, 2005
I was wondering if anybody could help me out a little. My goal is to
update some information about a system every 2-5 seconds. The
information needs to be displayed in some sort of table, but the size
of the table needs to be able to shrink and grow. The main problem
here is updating the table without refreshing the entire page and
making any clicking noises. I was thinking maybe I can put the table
in an iframe and use javascript somehow to update the iframe whenever
neccesary.
View 2 Replies
View Related
May 17, 2011
I have <div id ="changeable"> with some html in it. I have a link that calls the function to replace the info in the div. The problem is that the "creative_development.inc" file is added to the top of the div and does not replace the content. How do I replace the content, and not just add content?
View 1 Replies
View Related
Dec 4, 2009
I'm creating a simple auto updating script based on PHP and using jQuery to set the interval to 1000 miliseconds. It works in FireFox, as the only one I've tested so far, but in Internet Explorer (Version 7 right now, didn't test others) it just freezes and doesn't auto update. Doesn't auto update either if I refresh the page, so something's messed up here.I'm using the same way of auto updating on other things, such as a chat-page - works on those in all browsers, so I'm kinda on a lost track here.
Here's the JavaScript/jQuery:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
[code]....
View 2 Replies
View Related
Jan 19, 2006
I've not done much in the way of JS, if really anything other than using javascript.com before, so this may be me bieng quite m00bish, but I am having problems with my script on a page.
In a nutshell, the script I have currently allows my viewers to make a selection from a drop-down list, and as a result, the embedded WMP object below starts streaming the selected video.
WMP gets the video name from the VALUE= element of each list item.
My aim is that as well as the page starting the selected video, that a paragraph of text will appear under the WMP object based on the selection showing information regarding that video.
I've tried playing with a VAR element, and then using document.write to print the variable name to the screen, but this only writes the value of the variable at the time of page loading, and does not refresh.
View 2 Replies
View Related
Apr 14, 2006
What I am trying to do is assign a value to unchecked checkboxes. To do this I am running a function upon the submission of a form that checks the boxes for a value, and if they are not checked, assigns a value to them. I though I had it working, but for some reason I am getting a syntax error with the line that contains the "else"
My code is as below. The form name is deleterows and the form is dynamic so there can be any number of checkboxes (hence the for loop). Code:
View 5 Replies
View Related
Nov 12, 2004
I'm trying to make a physics program and have run into some trouble when i tried to update the div element by using the document.getElementById("target").innerHTML=c command, its in a loop and is supposed to update through every increment of the loop, but rather it only updates when it reaches the end of the loop. Here's the code:
View 3 Replies
View Related
Oct 23, 2010
I have a slideshow that also has links to allow the user to pick which slide they want to go to. That works okay for the most part, but once the user has selected a slide the slideshow continues to run, which I want to happen, but it continues to the next slide from when the loop function ran initially instead of the next slide in the show from the current slide. I tried recalling the function from the link function, but that really didn't do anything. I realize...at least I think that I realize that the function needs to be rerun from the new value of the count variable, but everything that I've tried to make it do that has been a colossal fail.Again I'm a novice here and this has to be written in plain javascript, otherwise I'd have gotten this done via jquery in probably 3 lines of code.
Here's what my code is looking like right now:
<script type="text/javascript">
<!--
//preload images
[code]...
View 3 Replies
View Related
Jan 29, 2010
I've made a simple ajax script that's supposed to update a captcha image. The only part that doesn't work is where the new image replaces the old one on the page. The problem is that they both have the same source name which means that if I just update the image src, or the innerHTML of the div surrounding it, nothing happens, since the image src is the same and so would the innerHTML be.
View 1 Replies
View Related
Mar 11, 2011
I'm using jQuery 1.3.4 right now, and I have the problem where .css is not updating the style information of two items:The code below produces the underlined lines of output. The red parts show where I expect my calls to .css to update the values, and I do not see updated values. I've added '//FAIL' after the lines that aren't doing what I expect them to do, and also highlighted them in red.nyone have an idea what I might be doing wrong, or what might be causing this?
Element X (701.4833374023438) Y (284.41668701171875) W H cont(PM_MENU 499.48333740234375 217.06666564941406 200 47 itc() 501.48333740234375 284.41668701171875 200 13 INITIAL submenu (PM_BC_MENU) 86.58332824707031
[code]....
View 3 Replies
View Related
Mar 25, 2009
I have a program that via an html form asks the user for information. When the user clicks submit a function is run that checks the values, if the values aren't of the correct type (nan etc) then an alert box pops up. If not then it proceeds to the results.
My problem is that the values of the fields in the form are picked up when the submit button is first pressed but when I correct the field errors and press submit again, it throws up the same errors in the alert box.
So how come the first time I press submit it gets the updated values of the variables (which contain the form values) but the second time it doesn't and I have to refresh??
View 4 Replies
View Related
Aug 17, 2009
I'm trying to set up a new window that contains a button. Then, if the user clicks the button, the window would display new information accordingly. I have written a simple test that won't seem to work:
<html>
<head>
<script language="Javascript" type="text/javascript">
var count = 0;
function Window() {
[Code]....
View 2 Replies
View Related
Sep 16, 2011
I just wrote some javascript with a counter to call an ajax call of many records, but when it is around the 50th record the counter variable is not updating in time for the next ajax call resulting in duplicate results cause ajax is pullin the previous query again
View 4 Replies
View Related
Nov 15, 2011
I have a scroller on my pages that basically reads a text file and displays.. The problem that I am having is it doesn't update until I reload the page(even though the .txt file updates about every 3 minutes).. I would like it to update when the file has been changed.. Here is my page.
[Code]...
View 3 Replies
View Related
Jul 25, 2005
i've a simple script that basically replaces the textnode attached to the title tag. and i thought since i'm updating the title tag the window title will automatically change. unfortunately it does not :(. what is wrong ?
function getText(txtMsg) {
if ( document.createTextNode ) {
return document.createTextNode(textMsg);
}
return false;
}
function setTitle(newTitle) {
var title = document.getElementsByTagName("title");
if ( title[0] ) {
title[0].replaceChild(getText(newTitle), title[0].firstChild);
}}
i know for sure this can be done coz gmail does that...but still wondering how else ??
btw i checked if this was getting updated to to DOM properly and it did that too
View 3 Replies
View Related
Jan 17, 2011
I am working on submitting a form with various info to update on db using jquery, ajax. The db is updating perfectly when I disable JS on firefox. When enabled, a few fields (adID, userID, comments) are not updating on the db. The field userID updated as zero, but the other two are blank.
[Code]....
View 7 Replies
View Related