Source code for /src/cross_domain_test_B2.htm.txt

//======================================================================//
// Author: Mark Qian <markqian@hotmail.com>                             //
// WWW: http://www.coolshare.com                                        //
// Copyright (c) 2006, Mark Qian                                        //
//                                                                      //
// You must contact Mark Qian to get a permission of use                //
// in case you want to make any use of the codes except viewing it     //
// on Mark's site.                                                      //
//======================================================================//


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type=text/javascript src=../../js/xmlhttp.js></script>
<script>
function call() {
  try {
 parent.callFrom("B (coolshare.com)");
  } catch (err) {
   alert("Error: "+err.description);
 }
}
 function call2() {
  try {
   parent.frames[1].callFrom("B (coolshare.com)");
  } catch (err) {
   alert("Error: "+err.description);
 }
 }
function callFrom(x) {
 try {
 alert("B: got a call from "+x);
 } catch (err) {
   alert("Error: "+err.description);
 }
}
</script>
<body>
<h3>This is frame B (loaded from Coolshare.com)</h3>
<input type=button value="B calls to A (coolshare.com)" onclick="call()">
<input type=button value="B calls to C (RemoteScriptGuru.com)" onclick="call2()">
</body>
</html>