We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

href question

mpaert
mpaert asked
on
Medium Priority
292 Views
Last Modified: 2010-04-09
I want to have a link open in a new window. This is what I've currently got:

<a href="#" onClick="MM_openBrWindow('http://www.domain.com/file.html','Name','status=yes,scrollbars=yes,width=600,height=400')">

The problem is that "#" reloads the page and displays it at the top, a bit annoying if this link is further down the page, and visitors need to re-scroll down to find this section. Is there any way to get around this?

Also, Is it possible to have the pop-up window centered on the clients' page, regardless of screen resolution?
Comment
Watch Question

Commented:
<a href="#" onClick="MM_openBrWindow('http://www.domain.com/file.html','Name','status=yes,scrollbars=yes,width=600,height=400'); return false">

Author

Commented:
Thanks Lakio. Any ideas about positionling the pop-up centrally?

Author

Commented:
Slight change of plan, I'm using this for the description of an eBay auction, and, as it seems, eBay won't let me have a pop-up window. So far, the only thing I've been able to do is to open a link in a new window.

See http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=9704972035# - In the "VPS Value" section you can see "Upgrade Options". Under that header, you have two "[Details]" links. These links are supposed to display a new window with information. As I'm not able to have those, has anybody got any good suggestions on how or which HTML to use so that visitors can press the [Details] link and get informtaion on those upgrades...
Commented:
you can have a layer with all the info or just open in a new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
THanks, but I wasn't able to have a layer displaid at all on ebay, they're very careful with which code can be used on their site.... I guess then it's just a link in a new window....

Author

Commented:
This is maybe the wrong forum, but maybe CSS can solve this???
CERTIFIED EXPERT
Top Expert 2004
Commented:
I took a quick look at the Ebay standards and you may be able to work with the layers.

Just have something like this:

href="#" onclick="document.getElementById('det1').style.display=(document.getElementById('det1').style.display=='none')?'':'none'; return false;">

and then have

<div id="det1" style="border:1px;display:none;">
Your Details
</div>

for each detail, changing det1 in both the Javascript and id

Commented:
well, all you can do with css is show text on mouseover, but really if its not your page then just open a new window

(you can open a window(1) and then with it open a popup(2) then closes (1) but I really think that a bad idea)
CERTIFIED EXPERT
Top Expert 2004

Commented:
I'd echo what Lakio said; with SP2, it's not even a guarantee the new window will open -_-

Commented:
if Zyloch thing works use it, or just open a normal window

Author

Commented:
Zyloch, you're a genius.

See http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=9704972035 and find the "Layer Test Link"

Could I have many "links" that point to the same layer, would I in this case just keep the same ID?

Author

Commented:
Sorry, another question. Do you know if it is possible to source the contents of a layer from another file without using iframes etc? I have 13 pages, all using the same layer contents. If I need to change one, I have to do it on all 13 manually... a bit of a pain...
CERTIFIED EXPERT
Top Expert 2004

Commented:
I'm afraid I know no easy way of doing so. Anything possible with Javascript (namely with xmlhttp) would most likely meet with a permission denied error since you cannot cross-site script.

However, you can have another link point to the content by using the same id in the Javascript.

Commented:
lol, I like the open a new page thing :)
CERTIFIED EXPERT
Top Expert 2004

Commented:
It depends on how you use it :D There's certainly nothing wrong with the new page, and you can even make it look nice, perhaps by centering the information and providing a close button :)

Author

Commented:
Thanks guys, the page looks much better now, with no navigation out of it for viewing the [Details] part. Any more suggestions how to present it better?

Author

Commented:
umm, I must have been writing whilst you submitted your message.

Can the text "Close" appear after one has clicked "Details"?
CERTIFIED EXPERT
Top Expert 2004

Commented:
Ah, I see. Sure, just have this:

onclick="var d=document.getElementById('det1');if (d.style.display=='none'){d.style.display='';this.innerHTML='Close';}else{d.style.display='none';this.innerHTML='Details';} return false;"

As always, change 'det1' to what is needed.

Author

Commented:
Done. Thanks so much.

Commented:
mpaert its looking good :)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.