<html>
<body>
<script id="test"></script>
<input type="button" id="button" value="获取" onclick="get('');">
<script type="text/javascript">
function get(url)
{
document.getElementById("test").src=url;
alert(data);
}
</script>
</body>
</html>
var data=123;
<html>
<head>
<script type="text/javascript">
document.domain="cuoxin.com";
</script>
<body>
<iframe src="" id="proxy"></iframe>
<script type="text/javascript" src=""></script>
<input type="button" id="button" value="获取" onclick="get('');">
<script type="text/javascript">
function get(url)
{
var proxy=document.getElementById("proxy").contentWindow;
proxy.createRequestObject(url,out)
}
function out(str)
{
alert(str);
}
</script>
</body>
</html>