Forum Moderators: open

Message Too Old, No Replies

IE6 alert fixing function?!?!?

         

natty

2:20 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



hi all,

this is a most strage one.
i shall attempt to explain, i have a page, with some dropdowns.
when selecting something from one drop down , it often triggers sometihgn to happen in another.
i also have different parts of the form split intop blocks (<div>'s) with a <br> in between to seperate them.


------------
¦ block1 ¦
------------
<BR>
------------
¦ block2 ¦
------------
<BR>
------------
¦ block3 ¦
------------

on picking an option from a dropdown in block1, which fires a change to another dropdown in block 1, the change being to remove an option , or fill it back in again.
on doing this, on the filling of this second dropdown in block1 , the <br> between block 1 and 2 disapears, thus squishing the two blocks together.
even worse, i find that if i stick an alert in the function that does this. all is well.. (apart from the alert being there ofc).
this is driving me totally mental.
anyone help? - to stop the br dissapoearing.
this ONLY happens in IE6. (6.0.2600 for sure, and proly 6.0.2800.xxx too)
i have also tried replacing the <br> with text, it still does it.
:'(

cheers,

nat

ps didnt post the html/js cos there was loads of it, will happily sticky it to anyone who wants.

korkus2000

2:24 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried it with <P> tags to see if the same thing happens?

natty

2:48 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



i hadnt no..
but it works a treat..
often the simple answer
thanks alot dude
:)

Birdman

3:03 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't know if will work, but you can also try using CSS on the form elements. This example should stack the dropdowns without having to use <br /> or <p></p>.


<select style="clear: both; margin: 15px 0px;">
<select style="clear: both; margin: 15px 0px;">
<select style="clear: both; margin: 15px 0px;">

gph

4:30 am on Apr 30, 2003 (gmt 0)

10+ Year Member



If an alert makes it work then it's likely a timing issue. Something is not ready when the function fires, the alert gives it time to catch up.

I've run into this type of thing before and usually start by putting a very small delay in the script


function stage_my_function() {
mytimer = setTimeout('my_function()', 10)
// 1000 = 1 sec, try increasing
// the delay if it doesn't work
}

function my_function() {
clearTimeout(mytimer)
// rest of function
}