How can I create a link to a local file on a locally-run web page?

I’d like to have an html file that organizes certain files scattered throughout my hard drive. For example, I have two files that I would link to: C:\Programs\sort.mw C:\Videos\lecture.mp4 The problem is that I’d like the links to function as a shortcut to the file. I’ve tried the following: <a href=”https://stackoverflow.com/questions/18246053/C:\Programs\sort.mw”>Link 1</a> <a href=”C:\Videos\lecture.mp4″>Link 2</a> … Read more

What is the difference between id and class in CSS, and when should I use them? [duplicate]

This question already has answers here: What’s the difference between an id and a class? (17 answers) Closed 5 years ago. #main { background: #000; border: 1px solid #AAAAAA; padding: 10px; color: #fff; width: 100px; } <div id=”main”> Welcome </div> Here I gave an id to the div element and it’s applying the relevant CSS … Read more

How to scroll to top of page with JavaScript/jQuery?

Is there a way to control browser scrolling with JavaScript/jQuery? When I scroll my page half way down, then trigger a reload, I want the page to go pack to the top, but instead it tries to find the last scroll position. So I did this: $(‘document’).ready(function() { $(window).scrollTop(0); }); But no luck. EDIT: So … Read more

How do I replace text inside a div element?

I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. <div id=”panel”> <div id=”field_name”>TEXT GOES HERE</div> </div> Here’s what the function will look like: function showPanel(fieldName) { var fieldNameElement = document.getElementById(‘field_name’); //Make replacement here } 14 Answers 14