Direct page to other page - html

I am using HTML and would like to know why when I enter
<a class="button flip" href="index2.html">List View</a>
it tries to find the original_page_url#index2.html
thanks
Charlene

From that code that you've put it shouldn't be doing that which means something else on your page is doing that. Javascript is the most likely culprit since it can easily change where your link actually goes. There may be other ways this could happen but I'd look at your javascript.
If you post a full page repro of the problem that we can use to understand the problem better that would help a lot. Preferably cutting out all the superfluous stuff on your page so its not too big. ;-)

Without further information from you, the only three things I can think of that would cause that are:
1) Your href in your question is different than your actual source, and there is a # sign before the index2.html in the a link. However, I'll assume you gave the correct href code above, in which case...
2) Some javascript on the page is automatically making that link act as an internal page link and adding the # itself. Make sure you don't have any javascript on the page that might be doing that.
3) The server has a rewrite rule that affects your links and appends them with the # sign. That would be rather odd, however.

Related

Firefox HTML inspector: how to copy single HTML tag?

I have a website and need to transport a form to another website. I however only need certain tags not the whole form block with all it's tables and divs.
When selecting a html-tag in inspector, I can copy inner HTML, outer HTML or CSS styles but how can I just copy that very exact tag I selected without it's child nodes, just the selected line in HTML code?
I ask this because the HTML is minified and I can't just select and copy a tag in source. Same when I chose "copy outer HTML" I get the whole HTML subtree minified, means everything in one line.
How can I quickly search and copy certain tags from the three without grabbing everything in the branch?
Edit: People, thanks for all your suggestions but please note that I wrote about a MINIFIED HTML page I have here.
Just open Debugger near Inspector
Then find page file... then copy with any select range as you want
UPDATE
if it minify click here
If I understood what you want try this
Since your question seems unsolved yet, let me come up with a creative approach I use for similar tasks from time to time:
(1) Creative solution: Page manipulation
If you don't have a javascript framework of your choice (e.g. jQuery) on that page, add it using a browser-extension that adds it when page has loaded.
Then you write a bit of javascript code that removes unwanted child elements of the desired parents in a loop or so. That sounds like lots of work but since you asked this question I assume you need dozens if not hundreds of elements so it might be worth taking the time to write such loop(s).
When the code you injected processed the page and removed everything you don't want, you can then copy the code like mentioned by others here.
(2) Alternative solution: Beautify the code beforhand
If the given solution(s) don't work for you, one could try to beautify the code by copying the source to a webpage that auto-indends html/js code. You could then optionally save it into a html-file and approach that one again like mentioned here before.
Sidenote
If either this idea is too much work or you need this frequently you are probably approaching this on the wrong side. When working on frontend (only) you are always limited to what you have. If you could approach from the backend you could then build from the data/information whatever you need. If you could provide a bit more information about why you need this and how much code you are talking about one could maybe come up with a more sustainable solution!

HTML/CSS - is is possible to have a html website with multiple pages - but only one menu (indentical) that can be called?

To start off with I can only use HTML and/or CSS. I do not have the capacity to use PHP or JavaScript?
I have researched an iFrame, but I'm not sure if it is possible to have a dropdown menu with an iFrame?
There's a very old-hat way of doing this called framesets, beware this is very old, doesn't look great and I'm not sure if it'll work well with dropdown menus e.t.c.
http://www.w3schools.com/tags/tag_frameset.asp has more on it.
Other than that the only thing I can think of is using PHP includes (which in you mentioned you don't have the capacity for) although I can go into detail about using PHP includes if need be.
Alternatively just repeating the menu code in each html page is the only other option as far as I know.
I personlally don't know a way which is just done with a HTML and CSS. But there is an easy way with PHP.
You make a file (nav.php) where you put your navigation stuff into it.
(Don't forget the php tags):
Now you can include the file in any HTML Document:
<?php include_once "filePath"; ?>
With just html&css, I only know copy&pasting. But with your wording, it sounds like you want just one menu like menu.html and linking it onto the multiple pages where you if you were to change the menu, you only need to change it in one section and don't need to copy and paste the rest. Since you want 1 single menu and link it to the multiple pages, I suggest the php way as Lorenz mentioned.
http://www.w3schools.com/php/php_includes.asp
...or another way I saw someone else do it is somewhere in this video by DevTips:
https://www.youtube.com/watch?v=nZoUA-98fL4
its something like {% filename %} but idk what lang. or whatever that's suppose to be. He just made his code look so much messier to me that I didn't bother looking into it.

HTML Adding subpages(children)?

I don't know if it's the fact I don't know how to phrase it or something, but I can't seem to find out how to add subpages.
I don't mean pages apart from the index, I mean this:
"www.example.com/portfolio" links to "www.example.com/portfolio/art"
rather than:
"www.example.com/portfolio" links to "www.example.com/art"
Any help would be appreciated, thanks.
You will need to use .HTACCESS with URL Rewrite method.
There are quite a few articles out there but you can check this one out;
http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
You will still need to create the HTML pages but the display will be different.
Honestly, there are multiple ways to accomplish what you are asking for and one other method is to do it with JQuery. You can change the URL and load the HTML inside the div. The best approach would be to use footer and header as static and load the HTML pages inside the body.

Enlarging Image in New Window?

I just did a quick search for my question and couldn't find anything directly on point.
I'm still very new to HTML and was wondering if someone could tell me how I could add a picture to my website and set the code so that if I click on it, it enlarges the picture in a new window.
I'm going to be adding around 600+ pics to my website so I was also wondering if there's a way to write the code once and have it apply to all the pics I add.
Thanks in advance,
- Danny B.
There's many many ways in which you could do this. The basic HTML for inserting an image with a link to a new window will be:
<a href="enlarged.html" target="_blank">
<img src="photos/photo-name.jpg" />
</a>
But it is a fair bit more complicated if you want to be able to dynamically display a large number of photos. If you want to code this yourself, you'll want to look into using something like PHP to output the HTML code automatically for 600+ images. Then instead of pointing the link for each to a new page, you might want to consider having the images load in a cool way, such as a javascript lightbox/colorbox some of the other answers suggest.
One possible alternative solution might be to look for some pre-created photo album script. I don't have any experience of these so I'll let someone else make some suggestions on that.
There are several ways to do this, but I'm assuming you'll have a simple site with lots of images on one page, and you'd like the images to zoom open "in a cool way".
Check out this: http://colorpowered.com/colorbox/
... click on View Demonstration and then see the various photo handling options.
This needs just some basic HTML and minimally configured Jquery. Very simple to use and produces a nice effect.
Google around using the keyword lightbox. Most of the solutions are ready-to-use Javascripts. Just include once, assign some IDs/classes, execute during onload and that's it. I personally have good experiences with Lightbox2 and jQuery Lightbox plugin.
I decided to go w/ target="_blank" -- Lightbox2 seems like it'd be great, but I'm really not sure how to use it and where to put all the code. The instructions I've found for it still assume the user has some standard knowledge in the field, that of which I do not currently possess. So, I'll stick to the target/blank approach until I can get more familiar w/ coding and then I'll upgrade to Lightbox.
Once again, I want to say thanks to everyone. You guys always respond quickly and accurately.
With much appreciation,
- Danny B
The simplest way would be to add a link to it, and set the target attribute to target="_blank". The link should point to the image itself. This would regularly open a new tab though, if you want a whole new window, you should tryhref="javascript:window.open('myimage.png','_blank','toolbar=no,menubar=no,resizable=yes,scrollbars=yes')",which would open a new, standalone window. If you're looking for fade/resize effects and such, try one of the other answers posted.

Stop pop-ups with URL

I've been asked a question, and don't know if there is an answer.
"do you know if there is some code you can put into URLs to block pop-ups?"
This isn't using pop-up blocking software or toolbars etc, but a parameter in the URL. Almost opposite to the target="_blank" for instance.
Assuming I'm reading your question right, it sounds like you want to block people from being able to open links in new windows/tabs within your site? There is nothing native in HTML you can do to block this. But you could use some javascript to do it:
Link
Now, mind you, this really breaks the way the anchor tag is supposed to work and presents a number of problems. If someone has javascript disabled, they can't use any of your links. I'd assume it'll also present problems for search-engine spiders as I doubt they follow javascript logic like that.
I'd personally avoid implementing something like this though and hate any site that went out of it's way to prevent me from opening a link in a new tab.
You can't do it for pages that aren't yours unless you're using a popup blocker.
If you're talking about making sure your own site doesn't open links in a new window you can do something like this within the <head> and </head> tags:
<base target="_self" />
However, I'm pretty sure this is the default anyway and will not keep a link that manually has it's target="_blank" from opening in a new window so I doubt it'll do you any good.