当前位置:编程学习 > VB >>

VB 调用JAVAScript脚本函数

我想在VB程序里调用Javascript编写的html网页脚本里的函数,我不大懂xxx.ini,xxx.htm,xxx.ico
这个脚本包里几个文件各有什么作用,但我就是想webbrowser浏览网页时能够执行xxx.htm里的函数,xxx.htm里的内容如下:
<script language="JavaScript">
//==========【开新窗口显示结果】==========
function showwin(x,y)
{
clipboardData.setData('text',y);
if(y!="")
{
  nw=window.open('','');
  nw.document.open('text/html','replace');
  nw.document.write('<html><head><title>《'+ x +'》的书签目录已获,提示:已放在剪贴板中!</title> </head><body><textarea id="urls" cols="115" style="font-size:12px;display:block">'+ y + '</textarea><br><input type="button" value="复制全部"  style="float:right;display:inline;" onclick="urls.select();document.execCommand(\'Copy\')">\r\n<div>\r\n<div id="butt_bar">\r\n</div>\r\n</div>\r\n</body>\r\n<script>urls.style.posHeight=document.body.clientHeight-80;urls.style.posWidth=document.body.clientWidth-20;<\/script></html>');

  nw.document.close();
  }
}
//==========【获取页面所显示的目录】===========
function get_muludiv()
{
divs=document.getElementById('div1').getElementsByTagName('div');//找到目录所在Div
var mulu_ar=new Array;
for(var i=0,j=0;i<divs.length;i++)
{
var pnum=divs[i].getAttribute("onclick")+"";
if(pnum.indexOf('showchildlist')>-1){pnum=0.99}//章标题
else
{
try{pnum=pnum.match(/.*GoTo.*/i)[0].replace(/.*GoTo.(\d+)\,.*/ig,"$1");}catch(e){}
}
if(pnum*1*divs[i].innerText.length > 0)
{
if(pnum==0.99){mulu_ar[j]=divs[i].innerText+"\t" + pnum.toString().replace(/0.99$/ig,"");}
if(pnum!=0.99){mulu_ar[j]="\t" + divs[i].innerText + "\t" + pnum;}
j++;
}
}
return mulu_ar.join("\r\n");
}
if(document.getElementById('b_title') && !document.getElementById('getmulu_a'))
{
muludiv_a='<a id="getmulu_a" title="点击将弹窗显示目录(带页码)" onclick="javascript:showwin(document.title,get_muludiv());">点击保存</a>'
document.getElementById('b_title').insertAdjacentHTML("afterBegin",muludiv_a);//在目录处嵌入“点击保存”
}
else if(!document.getElementById('b_title'))
{
document.title +='【无目录】';
}
</script>

那位高人指教一下,谢谢~~~ --------------------编程问答-------------------- VB程序里不能直接调用Javascript编写的html网页脚本里的函数,在网页脚本里加上Vbscript,才可以调用Javascript的函数
如果有更好的答案,我也想知道
补充:VB ,  网络编程
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,