Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2006, 04:12 PM
Ov1 Ov1 is offline
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old August 11th, 2006, 04:22 AM
HLH HLH is offline
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!!



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
 
Old August 11th, 2006, 05:47 AM
HLH HLH is offline
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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???:(:(

do you know why IE has this behaviour???



I hate IE





Similar Threads
Thread Thread Starter Forum Replies Last Post
Css layout not work well in Firefox kumiko CSS Cascading Style Sheets 0 March 31st, 2008 10:27 AM
cant get beerhouse Login to work in FireFox br BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 7th, 2006 12:09 AM
CMS doesn't appear to work with Firefox 1.5 abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 September 18th, 2006 10:45 AM
code in CH11 not work in FireFox din BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 January 18th, 2006 09:21 PM
onMouseOver does not work in FireFox crmpicco Javascript 23 November 9th, 2005 11:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.