简体   繁体   English

如何从另一个页面更改页面的html代码?

[英]How can I change html code of a page from another page?

At page index.htm, I have this list: 在页面index.htm上,我有以下列表:

<ul id="topic">
<li id="1">Thing1.</li>
<li id="2">Thing2.</li>
</ul>

I'd like to add and remove li itens from other page (painel.htm): 我想从其他页面(painel.htm)添加和删除链接:

At page painel.htm I'll have a input-text where the user writes the li container (thing1, 2, 3...) and a button to add or remove (currently in javascript-jquery). 在painel.htm页面上,我将有一个输入文本,用户在其中输入li容器(thing1、2、3 ...)和一个添加或删除按钮(当前在javascript-jquery中)。

I'd like to know the process that gives the information from the painel to the index. 我想知道将信息从痛苦中带到索引的过程。

At last case, I can make these pages asp using c#. 在最后一种情况下,我可以使用c#将这些页面制成asp。

Generate navs through js!

<script>
/* 2 pages nav or define your own */
var pages = [ [ {id:'1',title:'Thing1'} , {id:'2',title:'Thing2'} ] , 
              [ {id:'3',title:'Thing3'} , {id:'4',title:'Thing4'} ]
            ];

/* set current page through asp.net or php like currentPage =0 for index.html and currentPage =1 for painel.htm */

var currentPage = 0;
function renderNavs()
{
     var data = pages[currentPage];
     for(var i=0; i<data.length ; i++)
     {
          $('#topic').append('<li id="'+data[i].id+'">' + data[i].title + '</li>');
');
     }
}

$('#topic').empty();
renderNavs();
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何更改另一个 html 页面的 h1 元素? - How can I change a h1 element of another html page? 如何使用js和jquery onclick从另一个HTML页面检索代码 - How can I retrieve code from another html page using js & jquery, onclick 如何从谷歌 appscript 中的另一个 html 页面调用另一个 HTML 页面 - How can I call another HTML page from another html page in google appscript 如何从另一个页面更改按钮的状态? - How can I change the state of a button from another page? 如何在后面的代码中访问另一个ASPX页面? - How can I reach an aspx page from another in code behind? 如何从后面的代码更改页面的缩放级别? - How can I change the zoom level of a page from code behind? 如何使用javascript将值从一个html页面传递到另一个html页面 - How can I pass values from one html page to another html page using javascript 我如何将用户从另一个HTML页面重定向到HTML页面上的“部分”? - How can i redirect the user to a 'section' on an html page from another html page? 如何使用 AJAX 将参数从 1 个 HTML 页面传递到另一个 HTML 页面? - How can I pass parameter from 1 HTML page to another HTML page with AJAX? 如何通过单击另一个html页面上的按钮来编辑页面? - How can I edit a page by clicking a button on the another html page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM