p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript (http://p2p.wrox.com/forumdisplay.php?f=85)
-   -   Why does this work in Firefox but not in IE???? (http://p2p.wrox.com/showthread.php?t=45950)

Ov1 July 31st, 2006 04:12 PM

Why does this work in Firefox but not in IE????
 
Hi there. Can someone shed some light into this?
I'm using a CSS button for a login page. When i press enter on the input field my form is submitted but when i click on the button nothing happens. However, if i use Firefox, both pressing enter and clicking the button submits the form. How can i amend my code so that it works in IE also?
Any1?

Code:

<form name="login" action="asp/check_login.asp" method="post">
bla bla bla
<td align="left"><a href="javascript:void(0);" class="TextButt" onClick="valogin();">Log in</a>

The javascript function valogin is :
Code:

function valogin ()
{
var error=0;

if (isBlank(document.frmlogin.User.value))
{
    error++;
}

if (isBlank(document.frmlogin.Pass.value))
{
    error++;
}

if (error==0)
{
    document.frmadminlogin.submit();
}
}

Regards,
Ov1

HLH August 11th, 2006 04:22 AM

hello,

I have no idea of ASP (i´m php programmer) but my problem has exactly the same title than this one, so i will post it here.

ok, I hate IE :(, but I need to program things for it. And this code does not work. In my main file have a table where each row has two DIVs. the code is the following:

Code:

<DIV id="bloques">
<table class="tabbloques" ><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr></table>
</div>

well, then I try to attach events to them: when I click on "bloque" DIV, I want "inbloque" to appear and disappear (really easy).

I use the Eventutil.js code from Nick Zakas book. My code is the following:



Code:

function clickblock() {
    var bloqs = document.getElementById("bloques");

    var divs = bloqs.getElementsByTagName('DIV');
    alert(divs.length);
    var divCounter = 1;

    for(var no=0;no<divs.length;no++){
        if(divs[no].className=='bloque'){
        divs[no].id = 'bloque'+divCounter;
        divs[no].nextSibling.id = 'inbloque'+divCounter;

        EventUtil.addEventHandler(divs[no], 'click', toggle);

          divCounter ++;
          }
      }

}

I mean, I search for DIVS inside "bloques" and I alternate them the IDs and I attach the clickon toggle function to "bloqueX" DIVS.

It works properly in FF, but... in IE I have the following behaviour:

- If I execute the code as it is above, only the first DIVS couple will work (I mean, the toogle function will work).
- If I remove the TABLE, TR and TDs tags, then it won´t work in the FIRST couple of tags but it will work in the rest 9 cople of DIVS tags!!

[:0]

I have no idea what is happening. If I can´t solve this I will have to detect the browser from the server-side and Use different PHP code for each :(


I hate IE

HLH August 11th, 2006 05:47 AM

well... I think I found the problem (but I can´t belive it). With the code I wrote:

- The first DIV aplies the toggle function to ALL the content of the div (you can click anywhere and it works).
- For the rest od DIVS... I had to add some text and click on it (in my example it was empty so thats why it did not work), because the toggle function (in these cases) does not aply to ALL the DIV, but only to the content (text) of it.

behaviour???[xx(][xx(][xx(]:(:([:0][:0][:0][V]

do you know why IE has this behaviour???



I hate IE


All times are GMT -4. The time now is 06:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.