简体   繁体   English

供应来源<div>

[英]Supply Source for <div>

is it possible to Supply a External HTML for <div> tag? 是否可以为<div>标签提供外部HTML?

I have tried .load() in jquery but It bugs the textboxlist , and I tried using ajax too but it has the same effect with the textboxlist . 我在jquery中尝试过.load()但是它会textboxlist ,我也尝试使用ajax但它与textboxlist具有相同的效果。 is there anyway to supply the source for <div> in html like iframe ? 无论如何在像iframe这样的html中提供<div>的源代码?

example: 例:

<div src="existing.php"></div>

I found something like this, they said this works but for me it does not. 我发现这样的东西,他们说这样有效,但对我来说却没有。 so any suggestion? 那有什么建议吗?

I guess your jQuery selection is returning more than one element( the diva and some other elements in your form) and it updates everything. 我猜你的jQuery选择会返回多个元素(diva和你表单中的其他元素)并且它会更新所有内容。

Give a unique id to your div and you will be able to use load function without any probelms. 给你的div一个唯一的id ,你就可以使用load function而不需要任何问题。

HTML HTML

<div id="divExisting"></div>

Script 脚本

$(function(){
  $("#divExisting").load("existing.php");
});

The above function will make sure that the load function will be executed only after the dom loaded completely. 上述功能将确保仅在完全加载dom后才执行load功能。

我想你想要的是一个iFrame:

<iframe src="existing.php"></iframe>

Since you're using PHP, why not something like this? 既然你正在使用PHP,为什么不这样呢?

<div id="externalHTML">
   <?php include_once('existing.php'); ?>
</div>

Or should this page be loaded dynamically on the client side? 或者该页面是否应在客户端动态加载?

The text box list is very similar to jQuery Mobile. 文本框列表与jQuery Mobile非常相似。 It has to components, one is the input and the other one is another display box like: div or ul (unordered list) or something similar. 它有组件,一个是输入,另一个是另一个显示框,如:div或ul(无序列表)或类似的东西。 So what you need to do is either edit the input type text field or the unordered list html content and then use either getValues() or setValues() method and most likely folowed by the update() method. 因此,您需要做的是编辑输入类型文本字段或无序列表html内容,然后使用getValues()或setValues()方法,并且很可能使用update()方法。 For API documentation check this link: http://www.devthought.com/projects/mootools/textboxlist/ 有关API文档,请访问以下链接: http//www.devthought.com/projects/mootools/textboxlist/

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

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