如何使用锚标记显示内容 [英] how to display content using anchor tag

查看:73
本文介绍了如何使用锚标记显示内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击锚标记时,我想预览内容,

var profiledemo = profiles.split(,");
for(var pd = 0; pd< profiledemo.length; pd ++){
var mydiv = document.getElementById("Profile");
var aTag = document.createElement(''a'');
aTag.setAttribute(''href'');
aTag.innerHTML = profiledemo [pd];
mydiv.appendChild(aTag);
aTag. önclick= function(){
alert(配置文件锚标记称为");

}
}

我能够显示多个文档,对于那些我在上面使用了锚标签的文档,现在我想要的是,当用户单击特定标签时,我必须显示数据库中的文档内容.

I want to preview content,when i click on the anchor tag,

var profiledemo = profiles.split(",");
for (var pd = 0; pd < profiledemo.length; pd++) {
var mydiv = document.getElementById("Profile");
var aTag = document.createElement(''a'');
aTag.setAttribute(''href'');
aTag.innerHTML = profiledemo[pd];
mydiv.appendChild(aTag);
aTag. önclick = function () {
alert("profiles anchor tag called");

}
}

I am able to display multiple docs and for those docs i put anchor tag using above,now I want,when user click on the particular tag I have to display that doc content which is in database.

推荐答案

用户XMLHttprequest方法,用于从数据库中获取文档内容.否则,为这些锚标记编写另一个onclick方法.用这种方法提交表格.然后它将重定向到页面加载,在那里您可以获取div内容.否则使用Web服务,这会使您的需求变得非常微不足道.您不能从客户端建立数据库连接.
User XMLHttprequest method to get the doc content from database. otherwise write another onclick method for those anchor tags. in this method submit the form. then it will redirects to page load, there u can get the div content. otherwise use web services, it makes very esiar to your requirement. you can''t make a database connection from client side.


这篇关于如何使用锚标记显示内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆