Created
March 5, 2010 13:09
-
-
Save phiggins42/322704 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>SuperBasic Dojo Page</title> | |
<!-- load dojo from a CDN --> | |
<script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script> | |
<script> | |
// document is ready for DOM action | |
dojo.ready(function(){ | |
// update the title | |
dojo.byId("header").innerHTML = "Hello, Dojo"; | |
// fetch this page via XHR | |
dojo.xhrGet({ | |
url:window.location, | |
load:function(data){ | |
// add a new <p> explaining what is happeneing | |
dojo.place("<p>Here is the source of this page:</p>", "content", "before"); | |
// set the <pre> tag content to the data after replacing <'s to html-entities | |
dojo.byId("content").innerHTML = data.replace(/</g, "<"); | |
} | |
}); | |
// make the <pre> tag prettier, should do this in CSS really. | |
dojo.style("content", { | |
backgroundColor:"#ededed", | |
border:"1px solid #666", | |
color:"#101010", | |
padding:"18px" | |
}) | |
}); | |
</script> | |
</head> | |
<body> | |
<h1 id="header">Hello, World.</h1> | |
<pre id="content"></pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool, you can see live version here: http://browsercode.com/#gist=322704