HTML - On Onclick Include A File
I am trying to include a file on Onclick event on a button. But the code returns errors. Pls suggest.
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript"> function includefile() { <%@ include file="somefile.jsp" %>; } </script> </head> <body> <table> <tr> <td><input type="button" value="Click Here" onclick="includefile()"/></td> </tr> </table> </body> </html> Similar TutorialsI'm a newbie and I need help with using the #include directive. below is a sample file usinging the #include directive: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <!-- #include file="test.html" --> </body> </html> Here is the contents of test.html: <h1>header</h1> When I display the test.html in my brower the text show up. When I run the main file above with the include statement the contents of the test file will not appear. I've tried using #include virtual and I get the same results. both files reside in the same directory. How can I get the above files to work. I'm working with windows XP on a home computer. This problem occured in my actual website files becasue I want to include a header and a footer. These files of course have table tags etc in them and I get the same results where the include files contents do appear. I need help asap if that is possible. Trying to use this function i used the one it gives you in dreamweaver but it never seems to work. It will show in the preview on dreamweaver but when i run the .html file the content of the file that was included does not show. Here is what i used... Code: <!--#include file="PGS/DWNLDS.html" --> Any ideas of what i can do to get this to work? Thanks. Dear Members: I have a funny problem. I have two html files. I am trying to use test2.html as an Include file inside test1.html. I am not having any luck test1.html file reading test2.html. Test1.html code --------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> Your Title Here </title> <meta name="Generator" content="Alleycode HTML Editor"> <meta name="Description" content="Your description here..."> <meta name="Keywords" content="Your keywords here..."> </head> <body> <h1>This is my n include 1</h1> <h2>This is my n include 2</h2> <!--#include virtual="test2.html"--> </body> </html> test2.html code <h1>This is my include 3</h1> <h2>This is my include 4</h2> What I expect to see in the browser: This is my include 1 This is my include 2 This is my include 3 This is my include 4 But I see only This is my include 1 This is my include 2 It seems like the test2.html file is completely being ignored. May be it is a simple issue. But I tried everything. Both files reside on the same directory. If anybody could give me a suggestion, I shall truly appreciate it. As they say "It is driving me nuts"... Please help. Greetings I don't understand php at all and i have page in HTML. Now i have this guestbook script that i would really much like to add to the html page, so what now? My apache server can handle php and everything in the server end is right, but when i put this in to my html page: include($path."comment.php"); Nothing happens, now i suspect that i need to turn the whole page in to PHP. However i don't know how to do this, could anyone tell me how do i turn this page to PHP and get it to work? What is the code i need to put in to my html page? Please help this is important to me, thank you inadvance! Turhamuro Hi guys, I have a div on my page, which essentially just places a layer/table over the entire page and displays a "LOADING..." message, then promptly disappears when everything hidden beneath it has finished loading. I want to use this same div in several other pages, so I thought the best way would be to place it in an external file, then simply call it when required. Can someone please tell me how I can do this, i.e. what code I need to place in my HTML script to call an external div? I apologise if this is an obvious newbie-style question! But I appreciate any help that anyone out there can give me. Thanks in advance, Kate. If you want to include a template file how do you do that inside a html page? I want to include a footer.dwt file inside my html file...... I want to implement the footer.dwt file for all the pages of website....so i just want to call the footer.dwt file below my html page...... Help? Hi, I'm trying to include one HTML file in another. I tried iframe and was displeased with the results, I want the size of the frame to change dynamically and not just scroll. Fair warning, my knowledge of JavaScript is non-existent >_> . Basically, I have a document written in HTML (please don't suggest a wholesale re-write, that's simply not practical) and the idea is to have one file where it makes sense to include it several times. One thing to mention, this document is not meant to be shown on a web-server, but in a browser while you're reading it off your hard-drive. Here's what I have so far. main.shtml Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>test</title> </head> <body> <center> <h1> This is only a test! </h1> </center> <p> Still testing!!!!! </p> <!-- #include file="included.html" --> <p> Even more testing!!!!! </p> </body> </html> included.html Code: <!--<html> <head> <title> asdfasdfasdfasd </title> </head> <body>--> <p> <h4> foobar </h4> <br> <br> <br> <br> <h4> boofar </h4> </p> <!--</body> </html>--> Not sure what I'm doing wrong, help appreciated! aaaaaaaaaaaaaaaaaaaaa First off I hope this is going to the right category. If not sorry. I would like to include this http://www.d2w-fv.com/includes/toolbar.htm on every page of my site w/o having to c/p the code on to each page. I have tried PHP includes and failed several times. Any suggestions? My Server is Go Daddy! if that helps. Hi. Sorry if this is in the wrong section. I have made a menu http://www.checkpointdirect.co.uk/menu/mega3/ and it works. However, when I put... HTML Code: <?php include 'includes/mega3/menu.php'; ?> ...in the header.php file I get http://www.checkpointdirect.co.uk/ Any help would be great. Ignore the link names, there just example names. Thank you. Scott Hey guys I have made a site but I have noticed a potential problem. I have about 10 pages and each page has the menu coded on it using css. If I wanted to change the style of the menu then thats easy as I have a external style sheet. If I want to add a link I would have to open up every page and add the link to each file. Is there a way I can create the menu in one file and include it in each page. So if I want to add a link I just add it to the one file and it would be updated on every page. Cheers Matt Hi, I have a problem including a page to another. I'm using this code HTML Code: <!-- #include virtual="table.html" --> to add to my page, it work fine in the Dreamweaver. However, it doesn't work when i view in the browser. Lot of help I created a decent layout for a website using DIV layers with no problems. As the website is getting larger, adjusting certain elements on each page is very time consuming so today started using PHP includes. All I have done so far is change the file extension from .HTML to .PHP (I would later use the PHP include to pop the DIV layer with the menu onto a separate .PHP file to make it easier to add and edit it - had I have got that far ) I have changed none of the script on the file, only the extention, but one of my DIV layers has lost it's size and position (which was controlled by an external CSS).... Any ideas why it has done this? Thanks! what does this mean jdoc:include mean ? what tag is it ? <jdoc:include type="modules" name="menu" style="xhtml" /> thanks I've run into an article or three that show how to include headers, menus and other repetitive sections into my main html files. So I thought I'd try it out, following their examples,... and it's not working. I'm including the link to my test index.html. http://www.cubedspacedesigns.com/admosaic/ That boring red box is supposed to have some black text that comes from a header file. Here's the link to that. http://www.cubedspacedesigns.com/adm...es/header.html Am I typing things wrong, or am I supposed to install something on my server? I'm currently building a website for my jewelry and I have run into a simple, but aggravating problem. Should I include a back button? A back button would be the same a clicking on home, but are my visitors going to to know that? This is what it would look like with out a back button: http://i91.photobucket.com/albums/k3...backbutton.gif This is what it would look like with the back button: http://i91.photobucket.com/albums/k3...backbutton.gif Hi guys, I have a problem with HTML I've not experienced before relating to include files. I'm running IIS on Windows XP Pro and have an HTML file with a single include (this isn't the actual project I'm working on but a test I picked up off the web to demonstrate the problem) Test.html: - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 strict//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <!--#include file="testinc.htm"--> <br>To see this work. </body> </html> Testinc.htm: - ************************************************** ***** This is a test ************************************************** ***** When I open, in IE, http://localhost/test.html all I see is the text "to see this work". If I view the source, it is identical to test.html (ie, the include is in the source which would signify to me that it's been picked up as a comment). I've tried replacing Include File with Include Virtual (not that it should make any difference in this case as they're both located in wwwroot) but to no avail. Any ideas what's missing? Cheers in advance. Hello there! I hope any HTML expert can assist me on the following matter: I am trying to place some rotating ads on my website. Those ads are located on the "ads.php" file. If my website was written in php I would know how to call that file with the function: <?php include("ads.php"); ?> Unfortunately, my website is in HTML (cannot be changed to PHP for other reasons) and I don't know any HTML function equivalent to the INCLUDE function for PHP. Does anyone know how could I call the ads.php file in HTML? Thank you! |