Hi,
I'm not exactly sure why this doesn't work. I'm basically just trying a
simple approach at a slide down div.
function slide_div {
setTimeout("doc ument.getElemen tById('mydiv'). style.length='1 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='2 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='3 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='4 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='5 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='6 0px';",1000);
}
It seems like it just runs the last setTimeout line and pops out all at
once. I've even tried adding a=, b=, c=,. etc at the begining of each
line to no avail.
Anybody know a simple solution for this?
Thanks,
Max 6 10921
Max wrote:
Hi,
I'm not exactly sure why this doesn't work. I'm basically just trying a
simple approach at a slide down div.
function slide_div {
setTimeout("doc ument.getElemen tById('mydiv'). style.length='1 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='2 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='3 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='4 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='5 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='6 0px';",1000);
}
It seems like it just runs the last setTimeout line and pops out all at
once. I've even tried adding a=, b=, c=,. etc at the begining of each
line to no avail.
Anybody know a simple solution for this?
Thanks,
Max
Increment your milliseconds instead of using 1000 for all of them. e.g.
1000,2000,etc
Max wrote on 10 okt 2006 in comp.lang.javas cript:
I'm not exactly sure why this doesn't work. I'm basically just trying a
simple approach at a slide down div.
function slide_div {
a function needs ()
setTimeout("doc ument.getElemen tById
('mydiv').style .length='10px'; ",1000);
>
setTimeout("doc ument.getElemen tById
('mydiv').style .length='20px'; ",1000);
>
setTimeout("doc ument.getElemen tById
('mydiv').style .length='30px'; ",1000);
>
setTimeout("doc ument.getElemen tById
('mydiv').style .length='40px'; ",1000);
>
setTimeout("doc ument.getElemen tById
('mydiv').style .length='50px'; ",1000);
>
setTimeout("doc ument.getElemen tById
('mydiv').style .length='60px'; ",1000);
> }
It seems like it just runs the last setTimeout line and pops out all at
once. I've even tried adding a=, b=, c=,. etc at the begining of each
line to no avail.
They start all at [nearly] the same time,
so they all fire at [nearly] the same second later.
setTimeout() is NOT a wait() function.
Try:
=============== =============== ====
var mydiv = document.getEle mentById('mydiv ');
var myLength = 0;
slide_div();
function slide_div() {
mydiv.style.len gth= myLength + 'px';
myLength += 10;
if (myLength<=60)
setTimeout("sli de_div()",1000) ;
};
=============== =============== =====
not tested.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On Oct 10, 11:03 am, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
Max wrote on 10 okt 2006 in comp.lang.javas cript:
I'm not exactly sure why this doesn't work. I'm basically just trying a
simple approach at a slide down div.
function slide_div {a function needs ()
setTimeout("doc ument.getElemen tById('mydiv'). style.length='1 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='2 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='3 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='4 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='5 0px';",1000);
setTimeout("doc ument.getElemen tById('mydiv'). style.length='6 0px';",1000);
}
It seems like it just runs the last setTimeout line and pops out all at
once. I've even tried adding a=, b=, c=,. etc at the begining of each
line to no avail.They start all at [nearly] the same time,
so they all fire at [nearly] the same second later.
setTimeout() is NOT a wait() function.
Try:
=============== =============== ====
var mydiv = document.getEle mentById('mydiv ');
var myLength = 0;
slide_div();
function slide_div() {
mydiv.style.len gth= myLength + 'px';
myLength += 10;
if (myLength<=60)
setTimeout("sli de_div()",1000) ;};============ =============== ========
not tested.
Thanks for the suggestions. This worked fine and I now understand what
I was doing wrong.
Max
Max wrote:
document.getEle mentById('mydiv ').style.length ='10px'
Err, what's 'length'? I don't see this property at: http://www.w3schools.com/css/css_reference.asp
Shouldn't it be 'width' or 'height', or am I missing something?
Robin
JRS: In article <11************ *********@k70g2 000cwa.googlegr oups.com>,
dated Tue, 10 Oct 2006 08:47:52 remote, seen in
news:comp.lang. javascript, Max <ma*@kipness.co mposted :
> Anybody know a simple solution for this?
FAQ 4.20.
It's a good idea to read the newsgroup and its FAQ. See below.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
JRS: In article <eg**********@g emini.csx.cam.a c.uk>, dated Wed, 11 Oct
2006 09:55:15 remote, seen in news:comp.lang. javascript, Robin
<an**@somewhere .composted :
>Max wrote:
>document.getEl ementById('mydi v').style.lengt h='10px'
Err, what's 'length'? I don't see this property at: http://www.w3schools.com/css/css_reference.asp
Not the most reliable of sites, IIRC, but it should be OK here.
>Shouldn't it be 'width' or 'height', or am I missing something?
I'd suggest 'fontSize'. But specifying absolute font-sizes is generally
deprecated.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Knocked Wood |
last post by:
Hi,
I looked around and can't find anything on this at all and can not get
it to work for IE.
I'm trying to loop multiple sounds on a game, with three unique
variables, when a link is clicked. Something like...
<Script Language="JavaScript">
<!--
function playSound(soundName, loops, timeLength){
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {
document.images.src = eval("mt" +menu+ ".src")
}
alert("imgOff_hidemenu");
hideMenu=setTimeout('Hide(menu,num)',500);
|
by: Athanasius |
last post by:
Could someone shed some light as to why the following setTimeout
function will not work on the Mac IE5.2? It does however work on
PC(Forefox,Netscape,IE) & Mac(Safari,Firefox). Here is the script, it
should simply present an alert message after 5 seconds. Thanks.
<html>
<head>
<script language="javascript">
function MsgTimer() {
var self = this;
|
by: johkar |
last post by:
Why does this code work in IE and Firefox and the second example does
not work in IE. While these are just sample scripts, my actual scripts
will be transferring options from one multi-select list to another. I
want the most recently added one to scroll into view.
Works in both:
<html>
<head>
<title>test</title>
</head>
|
by: Matt Ratliff |
last post by:
Hello,
I would appreciate any assistance you have with the following
problem:
I have (as an example) an array of values as follows:
arrayvalues=new Array("0001","0003","0005") where each is the value
of an option in a select statement:
<select id="usertypes" multiple="multiple">
<option value="0033">data1</option>
| |
by: quill |
last post by:
Hi
I am making a chatroom script and it appears that the problem seems to be that my setTimeout's are conflicting.
The logic is as follows:
Run a login check every x seconds
Run a trigger check every x seconds
|
by: Memphis Steve |
last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file?
Here are the two scripts I want to use with the instructions on where to normally place them in an XHTML document:
SCRIPT #1:
Step 1: Insert the below anywhere into the <body> section of your page where you wish the clock to be displayed:<script>
/*
Live Date Script-
|
by: nigelesquire |
last post by:
Please help!
I'm trying to clone and delete multiple rows with JavaScript.
I need two delete buttons that work...!
I only have one for now, but it's not working properly, the output count is messing up.
Problems:
|
by: Atli |
last post by:
Hi everybody.
This is not so much a problem, since I have already managed to find a solution, but my solution requires the use of the eval() function, which I just hate to use.
The problem is this.
I have an object that has a function. This function needs to call itself in a setTimeout call. Using the "this" keyword from within the callback function will obviously not work, seeing as it would reference the new function rather than the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |