anchor

Replace anchor text with PHP (and regular expression)

萝らか妹 提交于 2019-12-24 03:26:21
问题 I have a string that contains a lot of links and I would like to adjust them before they are printed to screen: I have something like the following: <a href="http://www.dont_replace_this.com">replace_this</a> and would like to end up with something like this <a href="http://www.dont_replace_this.com">replace this</a> Normally I would just use something like: echo str_replace("_"," ",$url); In in this case I can't do that as the URL contains underscores so it breaks my links, the thought was

Selenium - Get location after clicking on an anchor

北城余情 提交于 2019-12-24 02:22:16
问题 I'm trying to check the fact that when I click on an anchor link, some section is really at the top of the browser (I hope I'm making sense here.) My test looks like that: class Tests(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome(chromedriver) self.accept_next_alert = True self.driver.set_window_size(1100, 800) self.base_url = "http://someurl" def test_anchor(self): driver = self.driver driver.get(self.base_url) driver.implicitly_wait(1) location = driver.find_element_by

Semantically correct nested anchors

谁说我不能喝 提交于 2019-12-24 00:59:08
问题 I am working on a web applicaton. And what we also create is something that could be described as inline editing. Just to portray thing I am trying to solve I use example of Facebook post. You have post like. Steve Jobs added 5 new photos Steve Jobs is link that redirects to his profile so in HTML, that would be: <div class="post-block"> <p><a href="stevejobs/" title="#">Steve Jobs</a> added 5 new photos.<p> </div> But what I want is the whole post "block" to be clickable although I want only

Scrolling to an element within a div

≡放荡痞女 提交于 2019-12-23 19:58:05
问题 I have an absolutely positioned div which acts as a modal window in the center of the page. The modal window is vertically scrollable with a scroll bar on the right hand side. The page itself is also vertically scrollable with a scroll bar on the right. I would like to be able to click on a link and have the modal window scroll to the linked item. I can pretty much achieve this using target.scrollIntoView(); but the entire page scrolls along with the modal window - I would like it so the page

Anchor Tag in chrome not working properly?Is this a chrome Bug?

旧城冷巷雨未停 提交于 2019-12-23 15:49:30
问题 I have a site http://rethinkwaste.com.au/ . When clicking on the very first slide I have a anchor set up <div id="illegal"></div> On the first load out in google chrome this seems to jump back up to the top of the page. Is this a chrome bug? If I then refresh or load page from slider link it seems to work ok. 回答1: I think its a Chrome bug. So After some searching i found this solution. jQuery(window).load(function(){ var hashNum = 0; if (window.location.hash != ''){ hashNum = window.location

“inherit” value doesn't inherit from “:visited” parent

左心房为你撑大大i 提交于 2019-12-23 15:18:27
问题 Consider the following HTML: <a href="http://google.com">foo <span class="bar">bar</span></a> and CSS: a { text-decoration:none; border-bottom-width: 0px; border-bottom-color: green; border-bottom-style: solid; } a:visited { color: red; border-bottom-color: yellow; } a:hover { color: gray; border-bottom-color: gray; } .bar { color: inherit; border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: inherit; } jsFiddle What I expect: The "bar" word should be colored red and

Spring Jsps and Jumping to Anchors

╄→尐↘猪︶ㄣ 提交于 2019-12-23 12:51:09
问题 I was wondering if there is some way in Spring to specify in the controller that I would like to send the client to a specific anchor within the .jsp page that I am using for my view. I have a section in my .jsp page, identified by an #errors anchor, that displays any form errors that occur. I would like to be able to send them directly to that anchor whenever I need to send them back to the .jsp after model validation fails. Inside my controller classes, I handle validation errors like so:

Why do bottom padding and bottom margins not help to add vertical spacing between these links?

你说的曾经没有我的故事 提交于 2019-12-23 12:10:06
问题 I have a div with links in it. And I'm lining them up one over the other with <br> tags because I couldn't figure out how to add vertical spacingn with CSS. I tried adding a bottom margin and a bottom padding to the a style rule but it didn't seem to have any effect (why?). I could add another <br> tag to separate them more but I have to assume there's a nicer way to do this with CSS that I just haven't been able to figure out. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

Scroll to position WITHIN a div (not window) using pure JS

安稳与你 提交于 2019-12-23 08:26:08
问题 PURE JS ONLY PLEASE - NO JQUERY I have a div with overflow scroll, the window (html/body) never overflows itself. I have a list of anchor links and want to scroll to a position when they're clicked. Basically just looking for anchor scrolling from within a div, not window. window.scrollTo etc. don't work as the window never actually overflows. Simple test case http://codepen.io/mildrenben/pen/RPyzqm JADE nav a(data-goto="#1") 1 a(data-goto="#2") 2 a(data-goto="#3") 3 a(data-goto="#4") 4 a

jquery selector: anchor elements by name

寵の児 提交于 2019-12-23 07:57:34
问题 I'm new to jQuery so this is probably simple, but... If I have this HTML: <a name="foo">Foo</a> how can I select the anchor element by its name foo ? It doesn't have an id property. 回答1: You can do it like this: $('a[name=foo]') It's called a attribute equals selector. 来源: https://stackoverflow.com/questions/8948758/jquery-selector-anchor-elements-by-name