这里介绍个在windows下面大概都能用的。
保存为renren.wsf 。代码:
<job id="WshShell">
<script language="JScript">
var ie=WScript.CreateObject("InternetExplorer.Application");
ie.Navigate("http://blog.renren.com/blog/0/addBlog")
ie.Visible=1
while(ie.Busy){
WScript.Sleep(500);
}
body=ie.Document.body;
// Header
var myinput=body.getElementsByTagName("input");
for(var i=0;i<myinput.length;i++){
input=(myinput[i].getAttribute("id"));
if(input=="title"){
myinput[i].value="AutoCreatedByJavaScript";
}
}
// Editor
var myiframe=body.getElementsByTagName("iframe");
for(var i=0;i<myiframe.length;i++){
if(myiframe[i].getAttribute("id")=="editor_ifr"){
WScript.Echo("Find iframe")
break
}
}
var iframe=myiframe[i]
win=iframe.contentWindow
doc=win.document;
tmpbody=doc.body
//WScript.Echo(tmpbody);
var tmp="<div>hello. This is created by JS</div>";
tmpbody.insertAdjacentHTML("beforeEnd",tmp);
// Submit
for(var i=0;i<myinput.length;i++){
input=(myinput[i].getAttribute("id"));
if(input=="editorFormBtn"){
myinput[i].click();
}
}
</script>
</job>
阅读全文
类别:默认分类 查看评论文章来源:
http://hi.baidu.com/mirguest/blog/item/c17f01bd50701b1918d81f4a.html