Old 22-03-2006, 12:20   #1 (permalink)
finbarr
who the fuck am i?
 
finbarr's Avatar
 
Join Date: Apr 2005
Location: london
Posts: 2,660
Send a message via MSN to finbarr Send a message via Skype™ to finbarr
link problem

this is the link as written by previous designer:

<a href="#" onMouseDown="MM_openBrWindow('www.linkhere','','to olbar=yes,scrollbars=yes,width=640,height=400')">B ook
online</a>
because the href has an # associated with it, clicking the link just refreshes the page/sends you back to the top.

But I cant figure out how the link should be written... I think I'm having a braindead afternoon.

Can anyone help?
  Reply With Quote
Old 22-03-2006, 12:25   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,205
return false; ?
  Reply With Quote
Old 22-03-2006, 12:30   #3 (permalink)
finbarr
who the fuck am i?
 
finbarr's Avatar
 
Join Date: Apr 2005
Location: london
Posts: 2,660
Send a message via MSN to finbarr Send a message via Skype™ to finbarr
Quote:
Originally Posted by smallbeer
return false; ?
that basically ignores the href link meaning the browser goes to the 'MM_openBrWindow' instruction?
and does it go in the href "insert here"?

or will putting 'javascript' in the href work?
  Reply With Quote
Old 22-03-2006, 12:33   #4 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,205
what?

<a href="#" onMouseDown="MM_openBrWindow('www.linkhere','','to olbar=yes,scr ollbars=yes,width=640,height=400');return false;">Book
online</a>
  Reply With Quote
Old 22-03-2006, 12:37   #5 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,563
Quote:
Originally Posted by finbarr
that basically ignores the href link meaning the browser goes to the 'MM_openBrWindow' instruction?
and does it go in the href "insert here"?

or will putting 'javascript' in the href work?
Return false means the link action is cancelled, so you go nowhere.
  Reply With Quote
Old 22-03-2006, 12:39   #6 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,563
Fwiw, I use a bit of script to detect the link type and launch popups if called. So if js is turned off, the user gets there anyway.

<a href="pop.htm" type="popup" title="Launch popup">

Very nice it is too.
  Reply With Quote
Old 22-03-2006, 12:40   #7 (permalink)
finbarr
who the fuck am i?
 
finbarr's Avatar
 
Join Date: Apr 2005
Location: london
Posts: 2,660
Send a message via MSN to finbarr Send a message via Skype™ to finbarr
Quote:
Originally Posted by smallbeer
what?

<a href="#" onMouseDown="MM_openBrWindow('www.linkhere','','to olbar=yes,scr ollbars=yes,width=640,height=400');return false;">Book
online</a>
Sorry, S if I'm sounding like a thicko!

The way I understand it is that the browser is reading the href="#" instead of going to the MM_Open command... right?

by putting in return false at the end, does that ensure that the browser reads the MM_open?

to clarify: I want the browser to read the MM_Open and ignore the href="#"
  Reply With Quote
Old 22-03-2006, 12:50   #8 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,205
did you try it?

return false stops you browser doing what it would otherwise have done. in this case going to #
  Reply With Quote
Old 22-03-2006, 13:22   #9 (permalink)
finbarr
who the fuck am i?
 
finbarr's Avatar
 
Join Date: Apr 2005
Location: london
Posts: 2,660
Send a message via MSN to finbarr Send a message via Skype™ to finbarr
having probelms with the system here so wont be able to check until tomorrow...

thanks for the help anyway
  Reply With Quote
Old 22-03-2006, 13:35   #10 (permalink)
i3lance
Read between da lines!
 
i3lance's Avatar
 
Join Date: Apr 2005
Location: UK, former Londoner
Posts: 846
Send a message via MSN to i3lance Send a message via Skype™ to i3lance
Ok firstly make sure this is in your header:

var newwindow;
function openwindow(url)
{
newwindow=window.open(url,'name','toolbar=yes, scrollbars=yes, height=640,width=400');
if (window.focus) {newwindow.focus()}
}

Then have this as your link mate:

<a href="page.html" onClick="openwindow('page.html'); return false;">Book online</a>

You asked Fin I answered!

Having the link this way also lets people to have JS disabled browse your links.
  Reply With Quote
Old 23-03-2006, 10:45   #11 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
Why have the return false in the onClick? put it in the function. But you really shoud be doing it like stickman does, progressive enhancement and all that.
  Reply With Quote
Old 23-03-2006, 11:52   #12 (permalink)
i3lance
Read between da lines!
 
i3lance's Avatar
 
Join Date: Apr 2005
Location: UK, former Londoner
Posts: 846
Send a message via MSN to i3lance Send a message via Skype™ to i3lance
Quote:
Originally Posted by stickmus
Why have the return false in the onClick? put it in the function. But you really shoud be doing it like stickman does, progressive enhancement and all that.

True, wanna post a link mate?
  Reply With Quote
Old 23-03-2006, 12:04   #13 (permalink)
finbarr
who the fuck am i?
 
finbarr's Avatar
 
Join Date: Apr 2005
Location: london
Posts: 2,660
Send a message via MSN to finbarr Send a message via Skype™ to finbarr
ended up just doing away with function and putting window.open on the link.

It was being messed up somehow by the in-house CMS and no matter what I tried it wouldnt work with the function.
The site is going to be overhauled very soon so they arent too worried about the solution in the interim
  Reply With Quote
Old 24-03-2006, 14:01   #14 (permalink)
i3lance
Read between da lines!
 
i3lance's Avatar
 
Join Date: Apr 2005
Location: UK, former Londoner
Posts: 846
Send a message via MSN to i3lance Send a message via Skype™ to i3lance
As long as you found a way matey
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8