How does a TWEET composition textbox work?

The Twitter input box is much more than your average INPUT or textarea. First off, it isn't an input or textarea at all. They are instead using a well crafted DIV with a "role" attribute. for the entire text; likely capturing keystokes as they occur. If a user is logged in, they can compose a tweet. If during that very cautious 140 character sprint, they accidentally click so

TWEET组合文本框如何工作?

Twitter输入框比您的平均INPUT或textarea多得多。 首先,它根本不是输入或textarea。 他们改为使用具有“角色”属性的精心设计的DIV。 为整个文本; 可能会在发生关键事件时捕获。 如果用户登录,他们可以撰写推文。 如果在非常谨慎的140个角色冲刺期间,他们不小心点击页面上的某个地方,浏览器会获得另一个页面。 但是,当用户点击“返回”时,DIV会重新填充(一秒之后),用户部分起草推文。 在浏览器功能方面,这个“保

Why there are some unknown attributes in the <nav> tag

I am pretty new to web design, falling into javascript design with bootstrap, but every now and then, I CAN find some attributes in tags that seems not supported anywhere. I am really confused. For example: the following code about "nav" tag <nav id="myNavmenu" class="navmenu navmenu-default navmenu-fixed-left offcanvas" role="navigation"> <a class="navmenu-brand" hre

为什么在<nav>标签中有一些未知的属性

我对网页设计很陌生,使用bootstrap进入javascript设计领域,但是现在我可以在标签中找到一些似乎不受任何支持的属性。 我很困惑。 例如:关于“nav”标签的以下代码 <nav id="myNavmenu" class="navmenu navmenu-default navmenu-fixed-left offcanvas" role="navigation"> <a class="navmenu-brand" href="#">Brand</a> <ul class="nav navmenu-nav"> <li class="active"><a href="#"

Twitter Bootstrap ARIA

there is a code of Modal.js from Twitter Bootstrap: <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</but

Twitter Bootstrap ARIA

有一个来自Twitter Bootstrap的Modal.js代码: <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

What does role=button mean?

I found that in Google+ Project's page that buttons are all made from divs like: <div role="button"></div> I'd like to know, is this just for semantic, all does it influence the style or event handle of the div? I tried to simulate click the button with JQuery click, but it doesn't work. It tells accessibility (and other) software what the purpose of the div is. Mo

角色=按钮是什么意思?

我发现在Google+项目的页面上,按钮全部由div制成,如: <div role="button"></div> 我想知道,这仅仅是为了语义,它是否会影响div的样式或事件句柄? 我试图模拟点击按钮与JQuery点击,但它不起作用。 它告诉可访问性(和其他)软件div的用途是什么。 更多在这里的role属性规范草案。 是的,这只是语义。 发送click事件到按钮应该工作。 这个答案的早期版本(早在2011年)说: ...但jQuery的click功

How can I open a link in new tab (and not new window)?

This question already has an answer here: How to open link in new tab on html? 11 answers CSS3 supports "open in new tab", by the property target-new target-new: window | tab | none; Update [2016]: this method never made it into the CSS3 spec, as one of the comments indicates. This shouldn't be used. However, it can be seen that most modern browsers open target='_blank&

我如何在新标签页中打开链接(而不是新窗口)?

这个问题在这里已经有了答案: 如何在html上的新标签中打开链接? 11个答案 CSS3通过属性target-new支持“在新选项卡中打开” target-new: window | tab | none; 更新[2016]:此方法从未将其纳入CSS3规范中,正如注释之一所示。 这不应该使用。 然而,可以看出,大多数现代浏览器无论如何都会在新选项卡中打开target='_blank'链接,除非尝试立即调整新选项卡的大小。 但是,规范中似乎没有强制这种行为的机制。

create an HTML button with Onlick that aslo works as a link?

I have a button that adds a product to a basket - I would like to make the button when clicked add the product to the basket via the onclick script - then redirect to a page trough an a href link or similar. Is this possible? HTML: <input type="button" id="pl157821buy" class="actionbutton" value="Köp" onclick="buy(this, 157821, null, 'pl157821qty',null, '/ajax/buy')"> 不确定这是最佳实践

创建一个与Onlick的HTML按钮,作为一个链接?

我有一个按钮,可以将产品添加到购物篮中 - 我希望在点击按钮时将按钮通过onclick脚本添加到购物篮 - 然后通过href链接或类似方式重定向到页面。 这可能吗? HTML: <input type="button" id="pl157821buy" class="actionbutton" value="Köp" onclick="buy(this, 157821, null, 'pl157821qty',null, '/ajax/buy')"> 不确定这是最佳实践,但您可以在致电buy()后立即使用window.location.assign("/your/other/page&q

HTML: how to create a "save as" button?

In your browser, when you want to save an HTML page that you are currently viewing, you normally go to the File menu and click Save As. Can I have a little button at the bottom of an HTML page that does the same thing? So instead of going to the File menu -> Save As, I want my user to be able to click the button to save the page on to the disk. There is a solution exists using Javascript

HTML:如何创建“另存为”按钮?

在浏览器中,当您想要保存当前正在查看的HTML页面时,通常会进入“文件”菜单并单击“另存为”。 我可以在HTML页面底部有一个小按钮来做同样的事情吗? 因此,不要进入文件菜单 - >另存为,我希望我的用户能够点击按钮将页面保存到磁盘上。 据我所知,有一个使用Javascript的解决方案,但它只适用于IE。 看到这里:链接文本 您可以让链接运行加载HTML文件的服务器端脚本,并使用Content-Disposition: attachment; filenam

How to go to a specific element on page?

This question already has an answer here: How can I scroll to a specific location on the page using jquery? 9 answers The standard technique in plugin form would look something like this: (function($) { $.fn.goTo = function() { $('html, body').animate({ scrollTop: $(this).offset().top + 'px' }, 'fast'); return this; // for chaining... } })(jQuery)

如何去页面上的特定元素?

这个问题在这里已经有了答案: 我怎样才能滚动到页面上使用jQuery的特定位置? 9个答案 插件形式的标准技术看起来像这样: (function($) { $.fn.goTo = function() { $('html, body').animate({ scrollTop: $(this).offset().top + 'px' }, 'fast'); return this; // for chaining... } })(jQuery); 然后你可以说$('#div_element2').goTo(); 滚动到<div id=&quo

How to prevent buttons from submitting forms

In the following page, with Firefox the remove button submits the form, but the add button doesn't. How do I prevent the remove button from submitting the form? <html> <head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> function addItem() { var v = $('form :hidden:last').attr('name'); var n = /(.*)input/

如何防止按钮提交表单

在下面的页面中,使用Firefox的删除按钮提交表单,但添加按钮没有。 如何防止删除按钮提交表单? <html> <head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> function addItem() { var v = $('form :hidden:last').attr('name'); var n = /(.*)input/.exec(v); var newPrefix; if ( n[1].length == 0 ) { newPrefix = '1'

HTML button to NOT submit form

I have a form. Outside that form, I have a button. A simple button, like this: <button>My Button</button> Nevertheless, when I click it, it submits the form. Here's the code: <form id="myform"> <input /> </form> <button>My Button</button> All this button should do is some JavaScript. But even when it looks just like in the code above, it s

HTML按钮不提交表单

我有一个表格。 在表格之外,我有一个按钮。 一个简单的按钮,像这样: <button>My Button</button> 不过,当我点击它时,它会提交表单。 代码如下: <form id="myform"> <input /> </form> <button>My Button</button> 所有这个按钮应该做的是一些JavaScript。 但即使它看起来就像上面的代码一样,它也会提交表单。 当我将标签按钮更改为跨度时,它完美地起作用。 但