Ok try this inplace of what you have at the minute:

$(this).click(function(){
        return false;
});

Thats what I meant before but i guess i didn't make myself clear.

Matt

Petruzzi, Tony wrote:
> I tried to do that and it still didn't work. I've been at this for quite 
> sometime now. Could someone on the outside, try the code in their browser and 
> tell me if they get the same error? 
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Oakes
> Sent: Wednesday, February 28, 2007 2:41 PM
> To: jQuery Discussion.
> Subject: Re: [jQuery] .attr("href", "javascript:void(0);") not working
>
> If your just trying to make the browsers default action from happening just 
> use "return false" (No quotes). Works well for me. Sorry if thats not what 
> your asking.
>
> Matt
>
> rip747 wrote:
>   
>> I'm trying to rewrite a plugin that I wrote a while back since the 
>> code has been lost. Basically this plugin makes it easy to have a link 
>> open in a popup window I'm having a problem preventing a new window 
>> from opening when using javascript:void(0). Below is the code.
>>
>> jQuery.fn.PopUpWindow = function(){
>>      return this.each(function(index){
>>              var setting, href, parameters, newwindow, a, b, c, $this;
>>              $this = jQuery(this);
>>              a = $this.attr("rel").split(",");
>>              href = $this.attr("href");
>>              settings = {
>>                      height:400, // height of window
>>                      width:400, // width of window
>>                      toolbar:false, // should we show the toolbar 
>> {true,false}
>>                      scrollbars:0 // should we show the scollbars {0,1}
>>              };
>>              
>>              // overrides the settings with parameter passed in using the 
>> rel tag.
>>              for(var i=0; i < a.length; i++)
>>              {
>>                      b = a[i].split(":");
>>                      if(typeof settings[b[0]] != "undefined" && b.length == 
>> 2)
>>                      {
>>                              settings[b[0]] = b[1];
>>                      }
>>              }
>>              
>>              parameters = "height=" + settings.height + ",width=" + 
>> settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + 
>> settings.scrollbars;
>>              
>>              /* there seems to be a problem with this code. For some reason 
>> browsers don't like
>>               * the fact that I'm setting the href to javascript:void(0) 
>> here.
>>               */
>>              $this.attr("href", "javascript:void(0);");
>>              
>>              $this.bind("click", function(){
>>                      var name = "PopUpWindow" + index;
>>                      return !window.open(href, name, parameters).focus();
>>              });
>>      });
>> };
>>
>>
>> An example of a link:
>> [a href="/popups/jurisdictions.cfm" class="popup"
>> rel="height:600,width:310"]click here[/a]
>> NOTE: I'm using brackets to get Nabble to display the code.
>>
>>
>> So the basic problem is that when  you click on the link it will open 
>> 2 windows instead of just the pop up. Any ideas on how to fix this?
>>   
>>     
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.4/705 - Release Date: 2/27/2007 
> 3:24 PM
>  
>
>   

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to