简体   繁体   English

SQL / PHP实时更改网站

[英]SQL/PHP real-time changes to websites

How can I allow user input on a page to change the HTML or CSS or anything. 如何允许页面上的用户输入更改HTML或CSS或任何内容。 Is there a technique for this? 这有什么技巧吗? Ie If it is client-side web design, how can I have input from a form moved to a certain page and displayed to replace previous content. 即如果是客户端网页设计,我如何将表单中的输入移动到某个页面并显示以替换以前的内容。 Let's say there is a main page with four links: Home, About, Links, Contact. 假设有一个主页面有四个链接:主页,关于,链接,联系人。 In the admin-edit page, there is a form to enter, edit, delete links. 在admin-edit页面中,有一个表单可以输入,编辑,删除链接。 Would I need a SQL database with the links' values that would populate this page and the other? 我是否需要一个SQL数据库,其中包含将填充此页面和另一个页面的链接值? Is there a better way to do this? 有一个更好的方法吗?

What you are looking for is javascript I believe. 您正在寻找的是我相信的JavaScript。 You can use any amount of Javascript or Jquery ( A javascript library) in order to do various things on a page after it has been loaded. 您可以使用任意数量的Javascript或Jquery(一个javascript库),以便在加载后在页面上执行各种操作。 In Jquery you attach "Listners" to divs and spans and whatever HTML elements you want that react in different ways such as the mouse hovering over, clicks, and such. 在Jquery中,您将“Listners”附加到div和span以及您希望以不同方式做出反应的任何HTML元素,例如鼠标悬停,点击等。

You can find the API for jquery here: http://jquery.com/ 你可以在这里找到jquery的API: http//jquery.com/

If you want to make permanent changes to some setting and such then yes you would need PHP along with a SQL database in order to store the results. 如果您想对某些设置进行永久性更改,那么您需要PHP和SQL数据库才能存储结果。 You would have to make panels for adding things to the database, editing, and retrieving them by using SQL insert, update, and select statements. 您必须使用SQL插入,更新和select语句创建用于向数据库添加内容,编辑和检索它们的面板。 You can read a bunch on how these things work at http://www.w3schools.com/ Good luck :) 你可以在http://www.w3schools.com/阅读一堆关于这些东西是如何工作的祝你好运:)

You want to change values in the "first" page in realtime using "second" page? 您想使用“第二”页面实时更改“第一”页面中的值吗?

You can do this with javascript, given that the "second" page is opened by the "first" page using window.open('second.html','second_page') 鉴于使用window.open('second.html','second_page')通过“第一”页面打开“第二”页面,您可以使用javascript执行此操作

Then in the "second" page, you can manipulate the "first" page by using something like opener.getElementById('someDiv').innerHTML = 'some text here'; 然后在“第二个”页面中,您可以使用类似opener.getElementById('someDiv')的东西来操纵“第一个”页面.innerHTML ='some text here';

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM