Home > Web Front-end > JS Tutorial > Javascript lets DEDECMS say goodbye to handwritten Tag_javascript skills

Javascript lets DEDECMS say goodbye to handwritten Tag_javascript skills

WBOY
Release: 2016-05-16 16:38:11
Original
1251 people have browsed it

1. Open the dedetempletsalbum_add.htm file and add the js method in the js script area in the top head.

1

2

3

4

function setag(){

 var tagg=window.showModalDialog("tags_main.php","tag","dialogWidth=800px;dialogHeight=600px");

  if(typeof(tagg) != 'undefined') document.form1.tags.value=tagg;

      }

Copy after login


2. In the td entered in the Tag tag, add


A button.

3. Modify the dedetempletstags_main.php file. Add the following js code in the js script area in the top head.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

//选择关键字

var tag="";

function selectTag(str)

{

tag=tag+","+str;

if (tag.substr(0,1)==',') tag=tag.substr(1);

 $("#selecttag").val(tag);

}

 

function selectTagOK()

{

window.returnValue= $("#selecttag").val();

window.close();

}

Copy after login

4. Add the following html anywhere in the body, PS: where you want to display it.

1

<div style="padding-left:20px;border:1px">所选TAG: <input type='text' id='selecttag' name='selecttag' size='80'/><input type="button" onClick="selectTagOK()" value="确定选择"/> </div>

Copy after login

5. Find

in the Tag list

1

<a href="../tags.php&#63;/<&#63;php echo urlencode($fields['tag']); &#63;>/" target="_blank">{dede:field.tag /}</a>

Copy after login

Change it to:

1

2

<a href="../tags.php&#63;/<&#63;php echo urlencode($fields['tag']); &#63;>/" target="_blank">{dede:field.tag /}</a>

<a href="#" onclick="selectTag('{dede:field.tag /}')">[选择]</a>

Copy after login

Usage help:

To modify the page, you can refer to the add page to add js code.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template