|
-
Jul 6th, 2003, 07:54 AM
#1
Thread Starter
Ex-Super Mod'rater
HTML: Importing HTML from another file
Is it possible, and if so how, to insert html into my html document like how this statement works for stylesheets??
Code:
<LINK href="StyleSheet.css" type="text/css" rel="stylesheet">
The problem is I have a section of HTML code that is the same in every page and if I want to change it it would mean going thro every file and changing each file. My thort of the solution would be if I could put this repeated code in a seprate file then in all my other files I would put something like the satement above to import it.
Any ideas??
Thanx
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jul 6th, 2003, 08:40 AM
#2
Fanatic Member
To the best of my knowledge. The <LINK> Tag is largely ignored by most browsers with the exception of the CSS.
With ASP you could just include the file but if you do not have ASP access, you might find the below exceptable for your needs.
I use the following JavaScript method extensively on an Intranet I develope that has now server side access.
Create your JavaScript File (MyHeader.js):
Code:
document.writeln("<table border=\"0\" cellspacing=\"4%\" cellpadding=\"5\">");
document.writeln("<tr>");
document.writeln("<td align=\"center\" bgcolor=\"#00D9FF\"><b><a href=\"http://www.RealisticGraphics.com\">Realistic Graphics</a></b></td>");
document.writeln("<td align=\"center\" bgcolor=\"#00D9FF\"><b><a href=\"http://www.VBForums.com\">VBForums</a></b></td>");
document.writeln("<td align=\"center\" bgcolor=\"#00D9FF\"><b><a href=\"http://www.google.com\">Google</a></b></td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<br>");
Create your HTML File (MyPage.htm):
Code:
<script language="JavaScript" src="MyHeader.js"></script>
Welcome to my JS Header Example. The above HTML was imported to this page.
Hope this helps.
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Jul 6th, 2003, 08:43 AM
#3
Thread Starter
Ex-Super Mod'rater
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jul 6th, 2003, 09:04 AM
#4
Fanatic Member
No problem, yell if you need anything else.
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Jul 11th, 2003, 01:09 PM
#5
what about IFRAMES
Code:
<iframe id="ifrmcontents" name="ifrmcontents" src="mypage.html" frameborder="0">
-
Jul 11th, 2003, 09:07 PM
#6
Fanatic Member
You could but it's not the same thing. Some versions of IE will display the iframe differently and some browsers won't display it at all.
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Jul 12th, 2003, 07:09 AM
#7
typical, that's the most annoying thing about web development.
-
Jul 17th, 2003, 05:56 AM
#8
Thread Starter
Ex-Super Mod'rater
I had tried IFrames but the thing is I was trying to insert the HTML into a table and when I used IFrames it messed up the layout. No worries anyway its sorted now, mind I couldn't get it to work using .vbs/.vb files instead.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|