怎么去asp.net的div id [英] how go to div id in asp.net

查看:78
本文介绍了怎么去asp.net的div id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我有个问题。请帮我。我的html文件包含div(id =abc)。我想点击按钮到网站去div(id =abc)...

解决方案

我想你只想在页面内导航。您只需创建一个锚标记并传递您想要导航的div的ID。





使用以下链接作为参考。





http://www.bloggersentral.com/2010/10/jump-to-section-or-part-on-same-page.html [<一个href =http://www.bloggersentral.com/2010/10/jump-to-section-or-part-on-same-page.html\"target =_ blanktitle =New Window> ^ ]


由于以下原因,似乎没有任何意义:没有转到div这样的概念。你不要去任何地方。



属性 id 用作元素标识符,在HTML文档。这不是获取DOM对象或其包装器的唯一方法。但是,如果它必须是 id ,这是在Javascript中查找DOM元素的方法:

 myElement =  document  .getElementById(  abc); 





另请参阅jQuery方式(强烈推荐):

http://api.jquery.com/id-selector [ ^ ],

所有其他选择器: http://api.jquery.com/category/selectors [ ^ ]。



如果您需要学习jQuery(强烈推荐),请参阅:

http://en.wikipedia.org/wiki/JQuery [ ^ ],

http://jquery.com [ ^ ],

http://learn.jquery.com [ ^ ],

http://learn.jquery.com/using -jquery-core [ ^ ],

http://learn.jquery.com/about-jquery/how -jquery-works [ ^ ](从这里开始)。



-SA


添加了一个,< a href =#id =atag/> ...... 

Hi everybody. i have a problem. Please help me. my html file contain div (id="abc"). I want to when click button to website go to div (id="abc")...

解决方案

i think you want to navigate inside page only. you can simply create an anchor tag and pass the id of the div where you want to navigate.


use below link for reference.


http://www.bloggersentral.com/2010/10/jump-to-section-or-part-on-same-page.html[^]


It does not seem to make any sense, by the following reason: there is not such concept as "to go to div". You don't "go" anywhere.

The attribute id is used as an element identifier, unique in the HTML document. This is not the only way to obtain a DOM object or its wrapper. However, if it has to be the id, this is the way to find the DOM element in Javascript:

myElement = document.getElementById("abc");



See also the jQuery way (highly recommended):
http://api.jquery.com/id-selector[^],
all other selectors: http://api.jquery.com/category/selectors[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com[^],
http://learn.jquery.com[^],
http://learn.jquery.com/using-jquery-core[^],
http://learn.jquery.com/about-jquery/how-jquery-works[^] (start from here).

—SA


in your div add a ,<a href="#" id="atag" />  ......


这篇关于怎么去asp.net的div id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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