我怎样才能创建一个JavaScript代码自动点击网站上的按钮 [英] How can I create a code with Javascript which Automatically click buttons on a web site

查看:148
本文介绍了我怎样才能创建一个JavaScript代码自动点击网站上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用Javascript创建一个代码,它自动点击按钮并用texbutton编写,并在网站上同时点击checkbutton。如果我这样做,这对我来说会非常有帮助。

 < html> 
< head>
< / head>
< body>
< a href =index.htmlclass =wp_textBox> Giris< / a>
< / body>
< script src =My_Link_>< / script>
< script type =text / javascript>
window.onload = function(){
window.location.href =('.wp_textBox')。attr('href');
});
}
< / script>

< / html>

实际上我无法创建代码,它不工作。在网站上,我们有文本按钮,选择按钮,复选框和搜索按钮,在第一个我们可以使用相同的代码文本框(我们可以在第一个文本按钮中添加相同的文本)。这就够了。但我需要在这个文本按钮中写一些东西来进行搜索。之后,对于这个搜索,我需要点击chechbuttun(A5)进行分类。我想要的最后一件事是点击搜索按钮(文本按钮已经写入,选择按钮已经点击,复选框已经点击)。



我该怎么做?我需要清楚地遵循哪种方式?有没有人有用java脚本的示例应用程序?



空屏幕输入屏幕



我想这样做,例如自动显示这张图片。 我想要的最终项目

解决方案

将id属性添加到您的锚点

 < a href =index。 htmlclass =wp_textBoxid =girls> Giris< / a> 

修改脚本标签。

  window.onload = function(){
document.getElementById('girls')。click();
});
}

编辑

要从js中填充文本字段,只需将 txtAuthDocNumber 名称的ID属性添加到您的文本字段并在代码中写下

  document.getElementsById(txtAuthDocNumber)。innerHTML =00VF832A; 

选择选项

 的document.getElementById( 'txtAuthDocNumberSelect')值= 00VF832A。 

复选框

  document.getElementById(check_box_id)。checked = true 

点击按钮

  document.getElementById('button_id')。click(); 


How can I create a code with Javascript which Automatically click buttons and writing in texbutton and click checkbutton same time on a web site. If I do that, it will be very helpful for me.

<html>
<head>
</head>
<body>
<a href="index.html" class="wp_textBox">Giris</a>
</body>
<script src=" My_Link_ "></script> 
<script type="text/javascript">
 window.onload = function() {
  window.location.href = ('.wp_textBox').attr('href');
});
}
</script>

</html>

Actully I can't create already code, its not working. To understand what I want actually.

On web site, we have text button, select button, checkbox and search button together, in the first we can use textbox with same code (we can wirte same text in text button in the first). It is enough. But I need to write some thing in this text button for searching. After that, for this searching, I need to click chechbuttun (A5) for classify. Last thing that I want is click search button (text button has writen, select button already clicked, checkbox already clicked).

How can I do that? Which way I need to follow clearly? Is there a somebody has example application with java script?

Empty Screen Input Screen

I want to do that I such as this picture automatically. Final Project that I want

解决方案

add id attribute to your anchor

 <a href="index.html" class="wp_textBox" id="girls">Giris</a>

modify the script tag like this.

window.onload = function() {
  document.getElementById('girls').click();
});
}

EDIT

To fill text field from js, just add ID attribute with txtAuthDocNumber name to your text field and write below code

document.getElementsById("txtAuthDocNumber").innerHTML="00VF832A";

For Select Option

document.getElementById('txtAuthDocNumberSelect').value="00VF832A";

For Check Box

document.getElementById("check_box_id").checked = true

To Click on button

 document.getElementById('button_id').click();

这篇关于我怎样才能创建一个JavaScript代码自动点击网站上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆