⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.html

📁 这个程序主要是利用MFC编译的一个可以定制浏览器窗口的程序
💻 HTML
字号:
<HTML>
<HEAD>
	<TITLE>Custom Test</TITLE>
	<script langauge="javascript">
	function fnIsOurCustomBrowser()
	{
		//Check to see if this is our custom
		//browser. We just see if the function 
		//IsOurCustomBrowser is available. By leaving
		//the brackets off of our function it is treated
		//as a property and thus allows us to check if
		//our method exists in the external window. If it
		//returns null then obviously this is not our custom
		//browser, so we return false.
		if(window.external.CB_IsOurCustomBrowser!=null)
			return true;
		else 
			return false;
	}	
	
	//setup a variable to let us know if this is our
	//custom browser.
	bIsCustomBrowser = fnIsOurCustomBrowser();

	if(!bIsCustomBrowser)
	{
		//You can check here to see if they have our custom browser.
		//If they don't you can do whatever you want, redirect them
		//to another page or whatever. For the purposes of this example
		//I will just alert them
		alert('你需要用定制开发的浏览器来看此页面才能得到真正的效果.');
	}

	function fnCallFunction()
	{
		//Call c++ function that we made
		//in our custom browser
		if(bIsCustomBrowser)
		window.external.CB_CustomFunction();
	}	

	function fnCallFunctionWithParams(strString, nNumber)
	{
		//Call c++ function that accepts parameters 
		//that we made in our custom browser
		if(bIsCustomBrowser)
		window.external.CB_CustomFunctionWithParams(strString, nNumber);
	}

	function fnOpenWindow(strURL, nLeft, nTop, nWidth, nHeight, nResizable)
	{
		if(bIsCustomBrowser)
		window.external.CB_OpenWindow(strURL, nLeft, nTop, nWidth, nHeight, nResizable);
	}

	function fnShowModalDialog(strURL, nLeft, nTop, nWidth, nHeight)
	{
		if(bIsCustomBrowser)
		window.external.CB_ShowModalDialog(strURL, nLeft, nTop, nWidth, nHeight);
	}

	function fnShowModelessDialog(strURL, nLeft, nTop, nWidth, nHeight)
	{
		if(bIsCustomBrowser)
		window.external.CB_ShowModelessDialog(strURL, nLeft, nTop, nWidth, nHeight);
	}
	</script>
</HEAD>
<BODY style="font-family:arial;font-size:10pt;" bgcolor="#eeeeee">
<h2><b><u>定制浏览器的测试页面</u></b></h2>

<p>javascript调用C++函数 &nbsp&nbsp&nbsp<input type="button" value="点击测试" onclick="fnCallFunction();"><BR><BR><BR> </p>
<p>调用C++函数并传入参数 <input type="button" value="点击测试" onclick="fnCallFunctionWithParams(document.all.param1.value,parseInt(document.all.param2.value));">
<BR><BR>参数一: <input type="text" name="param1" value="测试" style="width:60;"> <BR>参数二: <input type="text" name="param2" value="2008" style="width:60;"><BR><BR><BR></p>
<P>javascript打开用户定制的窗口 <input type="button" value="点击测试" onclick="nleft = 0; ntop = 0; nwidth = 800; nheight = 600;
fnOpenWindow('www.sina.com.cn',nleft,ntop,nwidth,nheight,1);"><BR><BR><BR></p>
<p>打开一个用户的有模式对话框 <input type="button" value="点击测试" onclick="nleft = 0; ntop = 0; nwidth = 800; nheight = 600;
fnShowModalDialog('www.ncut.edu.cn',nleft,ntop,nwidth,nheight);"><BR><BR><BR></p>
<p>打开一个用户的无模式对话框 <input type="button" value="点击测试" onclick="nleft = 0; ntop = 100; nwidth = 800; nheight = 500;
fnShowModelessDialog('www.google.com',nleft,ntop,nwidth,nheight);"><BR><BR><BR></p>
<p>弹出一个用户消息框 &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" value="点击测试" onclick="alert('用户消息框测试. 这样用户可以弹出任意信息的消息框了.');"><BR><BR><BR></p>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -