anchor

regex matching links without <a> tag

試著忘記壹切 提交于 2019-11-27 05:11:38
(http([s]?):\/\/?)(([a-zA-Z0-9]+(\.?))+)([a-zA-Z0-9]+((\.[a-zA-Z]{2,5}){1,2})((\/[a-zA-Z0-9\?&=_\-\~:/?#[\]@!\$&'()\*\+,;]*)*)((\.[a-zA-Z]{2,5}){0,2})) This is my regex which is working well for matching the links in the string. But I don't want it to select every link. If a link has "> before it, or </a> after it, that link shouldn't be mathced. How can it be done? These should be matched: adasdas http://www.stackoverflow.com asdasas adasdasahttp://www.stackoverflow.com/something asdas These should NOT be matched: adasdas<a href="somelink"> http://www.stackoverflow.com </a>asdasas adasdasa<a

How to remove the default link color of the html hyperlink 'a' tag?

无人久伴 提交于 2019-11-27 05:02:27
问题 The default link color is blue. How to remove the default link color of the html hyperlink tag <a> ? 回答1: The inherit value: a { color: inherit; } … will cause the element to take on the colour of its parent (which is what I think you are looking for). 回答2: you can do some thing like this: a { color: #0060B6; text-decoration: none; } a:hover { color:#00A0C6; text-decoration:none; cursor:pointer; } 回答3: .cancela,.cancela:link,.cancela:visited,.cancela:hover,.cancela:focus,.cancela:active{

Add http:// prefix to URL when missing

喜夏-厌秋 提交于 2019-11-27 04:29:41
Hello I have a very simple code <a href="'.$aProfileInfo['Website'].'" target="_self"> <div class="callButton">Website</div> </a> The problem is that if the user does not enter http:// the link will then point to my website and not to the external website as it should. How do I check in PHP if the user has not entered http:// and automatically add it when it is not there? A simple solution which may not work in all cases (i.e. 'https://'): if (strpos($aProfileInfo['Website'],'http://') === false){ $aProfileInfo['Website'] = 'http://'.$aProfileInfo['Website']; } David I think you'd better use

Prevent tabstop on A element (anchor link) in HTML

被刻印的时光 ゝ 提交于 2019-11-27 04:08:31
Is it possible to cancel an <a href="..."> from being tabstopped in any browser? I would like to do this without Javascript. Roberto Aloi Some browsers support the tabindex="-1" attribute, but not all of them, since this is not a standard behaviour. Modern, HTML5 compliant, browsers support the [tabindex] attribute , where a value of -1 will prevent the element from being tabbed to. If the value is a negative integer The user agent must allow the element to be focused, but should not allow the element to be reached using sequential focus navigation. dtharpe You could apply a JQuery handler to

Android Webview Anchor Link (Jump link) not working

大城市里の小女人 提交于 2019-11-27 03:58:36
I have a WebView in my Android App that is loading an HTML string using the loadDataWithBaseURL() method. The problem is that local anchor links ( <a href="#link"> ...) are not working correctly. When the link is clicked, it becomes highlighted, but does not scroll to the corresponding anchor. This also does not work if I use the WebView's loadUrl() method to load a page that contains anchor links. However, if I load the same URL in the browser, the anchor links do work. Is there any special handling required to get these to work for a WebView? I am using API v4 (1.6). There isn't much to the

Get anchor part of URL in controller in Ruby on Rails

有些话、适合烂在心里 提交于 2019-11-27 03:53:51
Is there a way to get the anchor part of a URL in a controller? Example: if I type http://www.foo.com/bar#anchor123 can I get the string anchor123 in my controller? True Soft You can't do that in Rails, because the anchor is not sent to the server. See mikeduncan.com/?s=named+anchors No sorry, it's not possible to retrieve the #anchor from the server-side (in any language). This is a client-side flag to tell the browser to move to a specific position in the page. But you can use some Javascript in the body to check for an anchor and send it back to the server using an Ajax-call... var anchor

window.location = #anchor doesn't work in IE

馋奶兔 提交于 2019-11-27 03:40:06
问题 On this map: http://web.pacific.edu/documents/marketing/campus-map/version%202/stockton-campus-2.0.htm I have an anchor at the top, and I want the page to jump to the anchor when a link is clicked. I'm currently using window.location = '#top'; It works as expected in FF, Opera, and Chrome, but not in IE 7. I've tried all permutations like window.location.hash and window.location.assign() and also scrollIntoView(true) and focus(). How can I make it work in IE? Edit : Nothing seems to work,

How can I render a ClickableTextCell as an anchor in a GWT CellTable?

我怕爱的太早我们不能终老 提交于 2019-11-27 03:35:06
问题 I've got a CellTable with multiple columns in simple TextCell()s. Two of the columns are 'clickable' via the ClickableTextCell() class, but I want to change how they look. What's the easiest way to get the cell contents to resemble an anchor tag, while still using a cell in the table? I've tried the following: 1. Implement a custom renderer to add anchor tags 2. Scouring Google looking for hints 3. Ignoring 'my library does it you just have to change your entire framework' links 4. Rolling my

Using jQuery to programmatically click an <a> link

点点圈 提交于 2019-11-27 01:06:15
I know this question has been asked before, but after a search on the web I can't seem to find a straight forward answer. the HTML <a id=myAnchor href=index.php> the jQuery (Both of these do not work) $('#myAnchor').click(); or $('#myAnchor').trigger('click'); What is the simplest and most efficient way to achieve this? user3346133 Try this: $('#myAnchor')[0].click(); It works for me. window.location = document.getElementById('myAnchor').href Click just triggers the click event / events not the actually "goto-the-links-href" action. You have to write your own handler and then your $('#myAnchor

How can I open multiple links using a single anchor tag

本秂侑毒 提交于 2019-11-27 00:57:32
So here's a simple but interesting question, how can I open multiple links using single <a> element? Using this only opens the first href <a href="http://www.google.com" href="http://www.yahoo.com" target="_blank">Click Here</a> You can certainly try this Demo <a href="http://www.microsoft.com" target="_blank" onclick="window.open('http://www.google.com'); window.open('http://www.yahoo.com');">Click Here</a> 来源: https://stackoverflow.com/questions/13965753/how-can-i-open-multiple-links-using-a-single-anchor-tag