Home >Web Front-end >JS Tutorial >Javascript lets DEDECMS say goodbye to handwritten Tag_javascript skills
1. Open the dedetempletsalbum_add.htm file and add the js method in the js script area in the top head.
function setag(){ var tagg=window.showModalDialog("tags_main.php","tag","dialogWidth=800px;dialogHeight=600px"); if(typeof(tagg) != 'undefined') document.form1.tags.value=tagg; }
2. In the td entered in the Tag tag, add
f656e964d821589a3ad2ec3696909da5
A button.
3. Modify the dedetempletstags_main.php file. Add the following js code in the js script area in the top head.
//选择关键字 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(); }
4. Add the following html anywhere in the body, PS: where you want to display it.
<div style="padding-left:20px;border:1px">所选TAG: <input type='text' id='selecttag' name='selecttag' size='80'/><input type="button" onClick="selectTagOK()" value="确定选择"/> </div>
5. Find
in the Tag list<a href="../tags.php?/<?php echo urlencode($fields['tag']); ?>/" target="_blank">{dede:field.tag /}</a>
Change it to:
<a href="../tags.php?/<?php echo urlencode($fields['tag']); ?>/" target="_blank">{dede:field.tag /}</a> [选择]
Usage help:
To modify the page, you can refer to the add page to add js code.