Re: [WSG] addEventListener

2006-01-19 Thread Choan C. Gálvez

Miika Mäkinen escribió:

[...]
Anyways, what I need to do is to add a "onclick" event handler to some
links, and make this return false. My goal is that users with javascript
turned on would go somewhere else than users without. Now, I need the click
event to return false, so that javascript users will not folloq the link in
the markup. But, for some reason a click event added with addEventListener
doesn't seem to ever return false. Does anybody know how to do it?
AttachEvent works fine (for IE).

I can achieve this using element.onclick, I'd just like to use
addEventListener for the sake of standards...

[...]

>

addEvent(a,"click",function(){alert('not going there!');return
false;});


>

[...]

>

When clicked any of the links, the above example should in
javascript-enabled clients display an alert "not going there" and NOT follow
the link... but it doesn't work in either FireFox or Opera 8 (on windows
XP).


Work it the DOM way:

event.preventDefault();

Unfortunately, IE doesn't support this method. So...

function fixE(e) {
  if (!e) {
e = window.event;
  };
  if (!e.preventDefault) {
e.preventDefault = function() { this.returnValue = false; };
  };
  if (!e.stopPropagation) {
e.stopPropagation = function() { this.cancelBubble = true; };
  };
  return e;
};


Use:

addEvent(a, 'click', function(e) { e = fixE(e); alert('not going'); 
e.preventDefault(); });


HTH,
Choan

**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**



Re: [WSG] firefox 1.5 is official

2005-11-30 Thread Choan C. Gálvez

Jay Gilmore wrote:
The one extension set that no longer works and I haven't found a 
solution is the libraries for Spellbound. I am not sure where to find 
the libraries. They are available at for Thunderbird. I really do use it 
alot for blogging and forum posting.


Check .

--
Choan
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**



Re: [WSG] A Fixed Understanding

2005-07-27 Thread Choan C. Gálvez

Chris Kennon escribió:

Hi,

If it is positioned relative to the viewport, why does it stay  confined 
within the container?


If I understand correctly, your `fixed` div is showing from the top-left 
corner of its container. If that's the case, there's one reason: you're 
not positioning the block.


Try something like

div#a {
position: fixed;
top: 100px; /* or 0 */
left: 100px; /* or 0 */
}

I've uploaded a little example to 
<http://dizque.lacalabaza.net/temp/fixed.html>.


And please remember: IE doesn't support `position: fixed`.

Regards,
Choan


On Jul 27, 2005, at 9:08 AM, Choan C. Gálvez wrote:


Chris Kennon escribió:


Hi,
Making sure I have grokked the CSS-P property-fixed, when an  
element  is fixed it is removed from the normal document flow and  
positioned  relative to its containing element,




Not exactly. It's positioned relative to the viewport. Every other  
point is correct.


Regards,
Choan



and does not scroll when the  document is? In the following example:
div#a would be removed from the normal flow and positioned  relative  
to the div#container, and would not move when the  document is scrolled.


div#container{
margin: 0 auto;
width: 500px;
border: 1px dotted black;
}
div#a, div#b, div#c{
width: 100px;
height: 100px;
border: 1px solid black;
}
div#a{
background-color: red;
position: fixed;
}
div#b{
background-color: green;
position: relative;
top: 20px;
right: 50px;
left: 50px;
}
div#c{
background-color: blue;
}




This is DIV a
This is DIV b
This is DIV C
Lorem ipsum dolor sit amet, consectetuer  
adipiscing  elit, sed diamesent luptatum zzril delenit augue duis  
dolore te  feugait nulla.


Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed  
diam  nonummy nibh euismod tincidunt ut laoreet dolore magna  aliquam 
erat


Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed  
diam  nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam


Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed  
diam  nonummy nibh euismod tincidunt ut laoreet dolore magna  aliquam 
era


Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed  
diam  nonummy nibh euismod tincidunt ut laoreet dolore magna  aliquam 
erat






**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**



Re: [WSG] A Fixed Understanding

2005-07-27 Thread Choan C. Gálvez

Chris Kennon escribió:

Hi,

Making sure I have grokked the CSS-P property-fixed, when an element  is 
fixed it is removed from the normal document flow and positioned  
relative to its containing element, 


Not exactly. It's positioned relative to the viewport. Every other point 
is correct.


Regards,
Choan

and does not scroll when the  
document is? In the following example:


div#a would be removed from the normal flow and positioned relative  to 
the div#container, and would not move when the document is scrolled.


div#container{
margin: 0 auto;
width: 500px;
border: 1px dotted black;



}

div#a, div#b, div#c{
width: 100px;
height: 100px;
border: 1px solid black;

}
div#a{
background-color: red;
position: fixed;




}
div#b{
background-color: green;
position: relative;
top: 20px;
right: 50px;
left: 50px;



}


div#c{
background-color: blue;


}










This is DIV a
This is DIV b
This is DIV C


Lorem ipsum dolor sit amet, consectetuer adipiscing  
elit, sed diamesent luptatum zzril delenit augue duis dolore te  feugait 
nulla.




Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat



Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam



Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam era



Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat








**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**



Re: [WSG] JAVA Script help

2005-07-11 Thread Choan C. Gálvez

Angus at InfoForce Services escribió:


 Can a person familiar with JAVA Script have a look at
 http://infoforce-services.com/personal/englishocanada.php and contact
 me off list at [EMAIL PROTECTED] and tell me what is wrong
 and how to fix it. Thank you.



Error: missing } after function body
Archivo de origen: http://infoforce-services.com/personal/englishocanada.php
Línea: 27, columna: 1
Código fuente:
}

Regards,
Choan

**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**