[nycphp-talk] Need some JS / HTML help
nasir81 at gmail.com
nasir81 at gmail.com
Sat Dec 22 21:32:56 EST 2007
Sorry, didn't mean to send a short and Curt reply. Javascript:void(0) in the herf will stop the browser from navigating away from the current page. i have used it in similar situations, where an onclick is required.
Regards,
Nasir
Sent via BlackBerry from T-Mobile
-----Original Message-----
From: David Krings <ramons at gmx.net>
Date: Sat, 22 Dec 2007 21:06:15
To:NYPHP Talk <talk at lists.nyphp.org>
Subject: Re: [nycphp-talk] Need some JS / HTML help
Hi!
Thanks Nestor, your examples helped at least to point me to the right
direction although you didn't copy the popup code, but the stuff that is in
the popup window. But I found the source page and could figure it out,
although their approach didn't work for me, but see below.
Néstor wrote:
> Here is an ezample on how to do it with a popup but I think that you can
> also do it
> if you put a link and set the target to blank "target=blank"
>
OK, I got the target in the regular hyperlink all set and that works at least
for those cases where JavaScript isn't an option. I still can't get anything
from JavaScript. What I did see in the Defintive Guide that one can write the
JS code into the fref attribute. That causes the browser to render the link,
which it didn't do before, and it opens the desired window, but it also
navigates away from the source page and in Firefox at least shows a blank page
with the text [object window]. It is halfways there, but as bad as before somehow.
But while I was writing this I got another idea that led to another idea and
some more googling and now I got it. I don't really know why it works, but it
does work:
<a href=""
onClick="javascript:window.open('http://localhost:8080/file:/F:/piviviewer/include/help/en_us/Default_CSH.htm#100',
'HelpWindow',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,width=350,height=250');">?</a>
What I'm surprised about is that in order to get a link rendered the href
attribute needs to be present, but when no URL is specified the click on the
link doesn't do anything, but the onClick event fires and executes the code.
But then I tried a subsequent link / button and as it turns out the popup is
behind the main window. So I needed to find a way to give it focus and after
some more googling I got this:
<button onClick="javascript:var
w=window.open('http://localhost:8080/file:/F:/piviviewer/include/help/en_us/Default_CSH.htm#100',
'HelpWindow',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,width=800,height=550');
w.focus(); return false;">Help Me</button><noscript><a
href="http://localhost:8080/file:/F:/piviviewer/include/help/en_us/Default_CSH.htm#100"
target="HelpWindow">Help Me</a></noscript>
And I got the CSH portion also down and with my little function I can
customize the button caption or only show a ? or have a text link with custom
text. I then tried the code without JavaScript enabled to see if the
<noscript> portion works, but that doesn't do a thing. If anyone knows how to
add the proper noscript code, let me know.
David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
More information about the talk
mailing list