Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]nicEditor - ustawienie kodu, aby link otwierał się w nowym oknie.
nigraS
post 12.10.2023, 09:56:18
Post #1





Grupa: Zarejestrowani
Postów: 179
Pomógł: 1
Dołączył: 25.11.2006

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


Jak ustawić ten kod, aby link zawsze otwierał się w nowym oknie i aby nie było wyboru czy otworzyć ma się w tym samym oknie czy w nowym?

[JAVASCRIPT] pobierz, plaintext
  1. var nicLinkButton = nicEditorAdvancedButton.extend({
  2. addPane: function() {
  3. this.ln = this.ne.selectedInstance.selElm().parentTag("A");
  4. this.addForm({ "": { type: "title", txt: "Add/Edit Link" }, href: { type: "text", txt: "URL", value: "http://", style: { width: "150px" } }, title: { type: "text", txt: "Title" }, target: { type: "select", txt: "Open In", options: { "": "Current Window", _blank: "New Window" }, style: { width: "100px" } } }, this.ln)
  5. },
  6. submit: function(C) {
  7. var A = this.inputs.href.value;
  8. if (A == "http://" || A == "") { alert("You must enter a URL to Create a Link"); return false }
  9. this.removePane();
  10. if (!this.ln) {
  11. var B = "java script:nicTemp();";
  12. this.ne.nicCommand("createlink", B);
  13. this.ln = this.findElm("A", "href", B)
  14. }
  15. if (this.ln) { this.ln.setAttributes({ href: this.inputs.href.value, title: this.inputs.title.value, target: this.inputs.target.options[this.inputs.target.selectedIndex].value }) }
  16. }
  17. });
  18. nicEditors.registerPlugin(nicPlugin, nicLinkOptions);
[JAVASCRIPT] pobierz, plaintext


Zauważyłem również, że podczas zapisywania "target="_blank" usuwany jest.
Czy to problem ze skryptem czy z tym edytorem?
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: 27.04.2024 - 22:18