關於html中的 script標簽中的 代碼寫法有效性? easyui tabs的href不能載入內容頁面
阿新 • • 發佈:2019-04-22
yui parser sele php 方式 script con 引號 -a
script標簽, 即 html中的 js腳本區域中:
- 它其實就是一個 普通的 html標簽, 在 html 渲染器 parser 看來, 它跟其他任何的普通 的 html標簽 , 比如 p 標簽, 比如 div 標簽 等等, 沒有 什麽兩樣,
- 因此, 凡是在 html 的 任何 普通標簽中, 比如 div 標簽中, 可以使用的 任何東西, 在 js script 標簽 中, 都是 一樣的 使用 , 而且 是同樣有效的 :
- 比如: 在 script 標簽中 一樣 可以使用 tp的 輸出變量, 一樣的可以使用 tp的U 函數:
}else{ tt.tabs('add',{ title:tit+' {$curClass}', // 使用 tp變量輸出 href:"{:U('pjcontent')}", // 使用 tp的輸出函數 closable:true, cache: true, });
- 比如, 在 script標簽中, 使用 圖標元素span:
title: ‘<span class="glyphicon glyphicon-edit"></span>‘ + tit , // 使用 span圖標
只是 重要的是, 在 easyui的tabs的 add 新增方法中 , 它的 content 屬性 , 或者 href屬性 的值, 的數據類型 : 必須是 字符串,
- 比如: content: ‘ ‘,
比如: href: ‘這個是一個 遠程的ajax 的 內容頁面的 字符串!!! ‘ , 必須是字符串, 所以 必須 加 引號.
否則, 就會 一直 顯示 loading... 的 ajax 加載過程即 這個地址 必須 用" {:U(‘content‘)}" 的 U 方法來寫, 或者是 直接寫出整個 完整的 地址: "/index.php/Home/Index/content.html" 來也是可以的!!
$('ul#jslist>li').click(function(){ var tit=this.innerHTML; if(tt.tabs('exists', tit)){ tt.tabs('select', tit); }else{ tt.tabs('add',{ title:tit, href:"/index.php/Home/Index/content.html", closable:true, cache: true, }); } });
關於html中的 script標簽中的 代碼寫法有效性? easyui tabs的href不能載入內容頁面