Click to See Complete Forum and Search --> : Including external code


netfrugal
02-28-2008, 08:54 PM
This is primarily for any language, including php. But I do have websites that call external scripts like this:


<html >
<head>
<title>calling external scripts</title>
<script type="text/javascript" src="http://www.somesite.com/file.js"></script>
</head>




I've never had difficulties calling javascripts from other servers. But I have been trying to experiment with scripts that are html or dhtml based. Here is a div tag that is located outside the server.

<div id='test' name='test'>
some more code here
</div>


Am I able to include this code (externally) on my webpage, even though it's from another place? I know it is easier and seemingly more logical to just embed the code like normal, but it's an interest of mine.

Weedpacket
02-29-2008, 02:40 AM
You can write Javascript that will request the external file and insert its content into the current page.

Moving to what strikes me as the more appropriate forum.

netfrugal
02-29-2008, 01:06 PM
Can you give an example of what you mean? This is what I am failing at.