Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> window.open
Rastman
post 12.03.2005, 22:19:33
Post #1





Grupa: Zarejestrowani
Postów: 177
Pomógł: 0
Dołączył: 6.06.2004

Ostrzeżenie: (20%)
X----


mam taki problem, kod wygląda następująco:
Kod
<a class="odnośnik" onclick="window.open('ogloszenie.php','toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,direc
ories=no,top=100,left=100,fullscreen=no,height=400,width=600');"></a>


chciałbym, żeby po najechaniu na link kursor zmieniał się w łapkę, ale nie chcę, żeby się przeładowywała po kliknięciu, dlatego nie korzystam z href, tylko żeby otwierało się nowe okno. jak to zrobić?

Ten post edytował Rastman 12.03.2005, 22:21:18


--------------------
Go to the top of the page
+Quote Post
SongoQ
post 12.03.2005, 22:39:35
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

Ostrzeżenie: (0%)
-----


A nie mozesz zrobic tak ze podajesz href i target="_blank"?


--------------------
Go to the top of the page
+Quote Post
bregovic
post 12.03.2005, 23:02:52
Post #3





Grupa: Zarejestrowani
Postów: 562
Pomógł: 15
Dołączył: 8.08.2003
Skąd: Denmark/Odense

Ostrzeżenie: (0%)
-----


Ja to robię tak
  1. <?xml version="1.0"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5. <head>
  6. <title>External links with JavaScript</title>
  7. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
  8. <script type="text/javascript">
  9. <!--
  10. function externalLinks()
  11. {
  12. if (!document.getElementsByTagName) return;
  13. var anchors = document.getElementsByTagName("a");
  14. var l=anchors.length;
  15. for (var i=0; i<l; i++)
  16. {
  17. var anchor = anchors[i];
  18. if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
  19. {
  20. var newAnchor = document.createElement('a');
  21. newAnchor.setAttribute('href', anchor.getAttribute('href'));
  22. newAnchor.innerHTML = '^';
  23. newAnchor.target = '_blank';
  24. newAnchor.title = 'Open link in a new browser window';
  25. newAnchor.setAttribute('class', 'external');
  26. anchor.parentNode.insertBefore(newAnchor, anchor);
  27. i++; l++;
  28. }
  29. }
  30. }
  31. window.onload = externalLinks;
  32. -->
  33. </script>
  34. <style type="text/css">
  35. a
  36. {
  37. text-decoration: none;
  38. color: gray;
  39. }
  40. a:hover
  41. {
  42. text-decoration: underline;
  43. color: black;
  44. }
  45. a.external
  46. {
  47. text-decoration: none;
  48. color: orange;
  49. font-size: smaller;
  50. font-weight: boldi;
  51. }
  52. a.external:hover
  53. {
  54. text-decoration: underline;
  55. }
  56. </style>
  57. </head>
  58.  
  59. <body>
  60. <p>
  61. <a href="http://polter.pl/">A normal link</a>
  62. | <a href="http://polter.pl/" rel="external">Poltergeist</a>
  63. | <a href="http://starwars.polter.pl/" rel="external">Starwars</a>
  64. | <a href="bla">bla</a>
  65.  
  66. | <a href="bla" rel="external">bla</a>
  67. </p>
  68. </body>
  69. </html>

Technika polega na dodaniu atrybutu rel="external" do każdego linka mającego otworzyć się w nowym oknie.

Ten post edytował bregovic 12.03.2005, 23:04:02


--------------------
Prank - for the fun. Mac - for the simplicity. Deviantart - for the kick.
Life is ours, We live it our way -- Metallica
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 10.07.2025 - 08:33