HighDots Forums  

What have I done wrong here?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss What have I done wrong here? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
News
 
Posts: n/a

Default What have I done wrong here? - 01-25-2006 , 06:35 PM






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?




Reply With Quote
  #2  
Old   
Jim Moe
 
Posts: n/a

Default Re: What have I done wrong here? - 01-26-2006 , 01:57 PM






News wrote:
Quote:
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().)
Quote:
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)


Reply With Quote
  #3  
Old   
News
 
Posts: n/a

Default Re: What have I done wrong here? - 01-26-2006 , 02:05 PM




"Jim Moe" <jmm-list.AXSPAMGN (AT) sohnen-moe (DOT) com> wrote

Quote:
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.




Reply With Quote
  #4  
Old   
News
 
Posts: n/a

Default Re: What have I done wrong here? - 01-26-2006 , 04:28 PM



"kchayka" <usenet (AT) c-net (DOT) us> wrote

Quote:
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.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.