anchor

Is it legal to have children of an anchor tag (<a>) in HTML?

喜夏-厌秋 提交于 2019-11-28 02:49:54
问题 Is it legal to have children of an anchor tag in HTML? For an example: <a> <font>Example</font> <img src="example.jpg"/> </a> It works fine in the browsers.But is it valid? Please help 回答1: Yes - even more so with the advent of HTML 5 (From the spec): Although previous versions of HTML restricted the a element to only containing phrasing content (essentially, what was in previous versions referred to as “inline” content), the a element is now transparent; that is, an instance of the a element

Anchor tag doesn't work in iPhone Safari

左心房为你撑大大i 提交于 2019-11-28 01:58:19
I'm having an issue with a named anchor tag in iPhone Safari browser. It works well in desktop browsers including Safari, but not working in mobile Safari. Weird! For example my URL looks like: http://www.example.com/my-example-article-url-is-like.php#articlebottom the above URL is from a newsletter and it should go to the bottom paragraph in article page which I gave id like this: <p id="articlebottom">paragraph is here</p> When I click the above URL from Newsletter it goes to the article page, but not the bottom para where I specify id. Although I can see that the #articlebottom part is

problem with javascript: return false is not working

落爺英雄遲暮 提交于 2019-11-28 01:28:05
Hey there is a link in my program as shown and onclick it calls the function clearform as shown: Html Code: <a class="button" href="Cancel" style="left: 55%;" onclick="clearForm()">Cancel</a> JavaScript Code: function clearForm(){ document.getElementById("subjectName").value = ""; return false; } return false is not working in this code. actually the first line of the function executed successfully but the return false was failed. I mean page is redirected to url "Cancel". Change your code as <a class="button" href="Cancel" onclick="return clearForm()">Cancel</a> Your problem is you need to

Nesting HTML- anchor tags

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 00:52:46
Today I was working on a tab navigation for a webpage. I tried the Sliding Doors approach which worked fine. Then I realized that I must include an option to delete a tab (usually a small X in the right corner of each tab). I wanted to use a nested anchor, which didn't work because it is not allowed. Then I saw the tab- navigation at Pageflakes , which was actually working (including nested hyperlinks). Why? They must be doing some really crazy stuff with JavaScript to get it to work (notice how neither the parent nor the nested anchor tags have a name or href attribute - all functionality is

Hyperlink in Android

女生的网名这么多〃 提交于 2019-11-27 22:11:03
问题 I have a question: How can I place a hyperlink WITHIN a text-block of normal text? I have some text and in the text I mention a URL and I want this URL to be in a different color, underlined and click-able. I know hyperlinks in android can be placed with "Linkify".. and i have referred android docs page Consider the same above paragraph with "android docs" i want to display in android..... 回答1: @Fedor.... i have found to give links from API Demos . this approach is finally be used for giving

How to force fully download txt file on link?

被刻印的时光 ゝ 提交于 2019-11-27 21:11:01
I have one simple text file and I want to download that file on any anchor tag link. But when I click on that link txt file shown me but not downloaded. I have try this code <html> <head> <title>File</title> </head> <body> <a href="test.txt">Click here</a> </body> </html> Download file when clicking on the link (instead of navigating to the file): <a href="test.txt" download>Click here</a> Download file and rename it to mytextdocument.txt: <a href="test.txt" download="mytextdocument">Click here</a> The download attribute specifies that the target will be downloaded when a user clicks on the

How to create an anchor and redirect to this specific anchor in Ruby on Rails

一曲冷凌霜 提交于 2019-11-27 21:01:42
I'm trying to create unique anchors for every comment on my blog so a person can take the url of an anchor and paste it in their browser, which will automatically load the page and scroll down to the point in the page where their comment starts. Perhaps I'm going about this the wrong way but I've tried this which was to no avail. Comment view - Fail 1 - when pasted in a browser this link does not scroll down to the desired position <%= link_to '#', :controller => 'posts', :action => 'show', :id => comment.post, :anchor => 'comment_' << comment.id.to_s %> Comments controller - Fail 2 - Correct

JavaScript - Jump to anchor

和自甴很熟 提交于 2019-11-27 20:40:48
I'm trying to open a div with a jump to the anchor. The opening part is working but it's not jumping to the named anchor This is my script: <script type="text/javascript"> function spoil(id){ if (document.getElementById) { var divid = document.getElementById(id); divid.style.display = (divid.style.display = 'block'); window.location = '#' + id; } } </script> <a href="http://example.com" onclick="spoil('thanks');" title="hello"> <img src="images/gfx.png" alt="world" width="300" height="300"/> </a> Any ideas what's wrong with it? Cheers. Alex K. Looks like you're unhiding a spoiler div. If so,

Making href (anchor tag) request POST instead of GET? [duplicate]

前提是你 提交于 2019-11-27 20:27:47
This question already has an answer here: Make a link use POST instead of GET 10 answers <a href="employee.action" id="employeeLink">Employee1</a> when i click the Employee1 link, GET request goes to server. I want to make it POST instead of GET request. Is there a way i can change default GET behaviour of href? Note:- I know it can be done where we can call javascript function on hyperlink click , then create form and submit it. But i am looking where we can mention some attribute in anchor tag to make POST request instead of GET request? Using jQuery it is very simple assuming the URL you

Auto-Scroll to next anchor at Mouse-wheel

不羁的心 提交于 2019-11-27 19:55:09
I have 5 anchors on my html page. Is there any way that the page scrolls automatically to the next anchor (#) by a single Mouse-wheel scroll? Is there a way that it happens regardless of the anchor's name? just to the next anchor. This works in Chrome, IE, Firefox, Opera, and Safari: (function() { var delay = false; $(document).on('mousewheel DOMMouseScroll', function(event) { event.preventDefault(); if(delay) return; delay = true; setTimeout(function(){delay = false},200) var wd = event.originalEvent.wheelDelta || -event.originalEvent.detail; var a= document.getElementsByTagName('a'); if(wd <