473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What have I done wrong here?

I have two functions both work in Firefox and Netscape but only one works in
IE. Both are working on different <DIV> tags. My CSS is an external file, I
linked it to the html file.

CSS/* set the width and height of each DIV the JavaScript will change them
later*/
div.a
{
width: 1%;
background-color: #9900FF;
height: 5%;
}
div.b
{
width: 100%;
background-color: #95F209;
height: 1%;
}

JavaScript /*the functions are to change the width or height of the DIV. */

function doWidth()
{
var Wdiv = document.getElementById("width"); //capture the correct
element
Wdiv.style.width = forWidth+'%'; //set a NEW width
if(forWidth++ > 99) //reSet
forWidth if required
forWidth = 0;
setTimeout("doWidth();",10); //recursive (I
think anyway)
}

function doHeight()
{
var Hdiv = document.getElementById("height");
Hdiv.style.height = forHeight+'%';
if(forHeight++ > 10)
forHeight = 0;
setTimeout("doHeight();",10);
}

HTML<!-- in Netscape and Firefox both above functions mess with the width
and height of the
DIV that are suppose to mess with. In IE nothing happens,
meaning the width or height
are not affected-->

<div id=width class="b">&nbsp;</div>
<BR>
<div id=height class="a">&nbsp;</div>
can someone point out my mistake here?

Jan 26 '06 #1
4 1222
News wrote:

function doWidth()
{
var Wdiv = document.getElementById("width");
Wdiv.style.width = forWidth+'%'; //set a NEW width
if (forWidth++ > 99) //reSet forWidth if required
forWidth = 0;
setTimeout("doWidth();",10); //recursive (I think anyway)
}
What is "forWidth"? The variable magically appears from nowhere and is
uninitialized. Same applies to "forHeight" in doHeight().)
<div id=width class="b">&nbsp;</div>
<div id=height class="a">&nbsp;</div>

can someone point out my mistake here?

Where do the JS functions get called? Nothing here shows that.
An URL showing a test case would be a lot more useful.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jan 26 '06 #2

"Jim Moe" <jm***************@sohnen-moe.com> wrote in message
news:lo******************************@giganews.com ...
News wrote:

function doWidth()
{
var Wdiv = document.getElementById("width");
Wdiv.style.width = forWidth+'%'; //set a NEW width
if (forWidth++ > 99) //reSet forWidth if required
forWidth = 0;
setTimeout("doWidth();",10); //recursive (I think anyway)
}

What is "forWidth"? The variable magically appears from nowhere and is
uninitialized. Same applies to "forHeight" in doHeight().)

<div id=width class="b">&nbsp;</div>
<div id=height class="a">&nbsp;</div>

can someone point out my mistake here?

Where do the JS functions get called? Nothing here shows that.
An URL showing a test case would be a lot more useful.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


forWidth and forHeight are globals. The original calls for both functions
are at the end of the HTML page.

I will start to put up my Not working pages so there will be a URL.
Jan 26 '06 #3
News wrote:

CSS/* set the width and height of each DIV the JavaScript will change them
later*/
div.a
{
width: 1%;
height: 5%;
}


And what, may I ask, do you expect to happen for those folks who don't
have JavaScript enabled? They make do with a teensy text box? ish

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jan 26 '06 #4
"kchayka" <us****@c-net.us> wrote in message
news:43*************@individual.net...
News wrote:

CSS/* set the width and height of each DIV the JavaScript will change
them
later*/
div.a
{
width: 1%;
height: 5%;
}


And what, may I ask, do you expect to happen for those folks who don't
have JavaScript enabled? They make do with a teensy text box? ish

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.

They will NEVER see this as I am just trying to learn how to change the
width and height dynamically.
Jan 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
8
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
39
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
3
dfound
by: dfound | last post by:
#include<windows.h> #include<dos.h> #include<dir.h> #include<fstream.h> #include<stdio.h> #include<process.h> #include"resource.h" //resource header file
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.