创建书签以填写表单 [英] Create bookmarklet to fill form

查看:136
本文介绍了创建书签以填写表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个书签,在第1,第2,第5和第6个文本框中填充文本,这样我就可以更轻松地使用网站上的工具,因为我经常使用它它不记得我的输入。
以下是Vertrek gemeente:,Straat:,Aankomst gemeente:和Straat:。

I want to create a bookmarklet that fills in 1st, 2nd, 5th and 6th text box with text so I can use the tool on the site more easily, because I use it frequently & it doesn't remember my input. These are the ones with this text in front "Vertrek gemeente :" , "Straat :", "Aankomst gemeente :" and "Straat :".

让我给出一些测试值(按顺序)

Let me give some test values (in order)

"gent"
"PATIJNTJESTRAAT"
"OOSTAKKER"
"HERMAN TEIRLINCKSTRAAT"

关于网站:这是一个荷兰的公共交通网站,你可以输入你的街道然后目的地街道,然后网络应用程序将计算你应该采取哪些公共汽车以及何时应该采取它们。

about the site: it is a dutch public transport site were you can input your street and the destination street and then the web application will calculate which busses you should take and when you should take them.

关于我:
我是新手JavaScript的。我知道你可以使用 getElemenbyId 但这个网站有很多脚本和这样很难获得身份证。我知道有一个(firefox)插件​​+插件,它让你检查元素(获取id)。它被称为萤火虫。我希望这有任何帮助。我不是100%确定bookmarklets是解决我的问题的方法,如果你有其他建议随时回复(我听说cookie可能是一个解决方案?或者可能是一个firefox插件?)

about me: I am a rookie at javascript. I know you can use getElemenbyId but this site has a lot of scripts & such wich makes it hard to get the id. I do know there is a (firefox) addon+plugin which makes you inspect elements (to get the id). It's called firebug. I hope this is of any help. I'm not 100% sure bookmarklets is the way to fix my problem, if you got other suggestions feel free to reply (I heard cookies might be a solution? Or maybe a firefox addon?)

如果您能帮助获取(javascript bookmarklet)此代码或可能的解决方案代码,请提前感谢,
如果您向我提供工作代码,请多谢一下。
感谢百万,如果你非常友好地向我提供代码&解释它是如何真正起作用的。

Thanks in advance if you can help to get the (javascript bookmarklet) code for this or a possible solution, Thank you even more if you provide me with working code. Thank a million if you are so kind to provide me with the code & explain how it truly works.

推荐答案

试试这个:

javascript: { document.getElementById('form1:vertrekGemeenteInput').value = 'Zedelgem';document.getElementById('form1:vertrekStraatInput').value = 'Berkenhagestraat';document.getElementById('form1:vertrekNrInput').value = '44';document.getElementById('form1:aankomstGemeenteInput').value = 'Oostakker';document.getElementById('form1:aankomstStraatInput').value = 'Herman Teirlinkcstraat';document.getElementById('form1:aankomstNrInput').value = '1'; void(0) }

我在Chrome上测试了这个,它在那里工作。

I tested this on Chrome, it works there.

至于获取元素,打开Chrome,然后打开检查器(在Control Shift J的窗口上),然后点击左下角的放大镜,然后你翻过网页并且您看到元素变为蓝色,如果您单击元素选项卡中将看到的任何元素相关标记,您将看到id,这就是我找到这些id的方式。 Je bent welkom;)

As for getting the element, Open Chrome, then open the inspector ( on windows that is Control Shift J ), then hit the magnifying glass in the bottom left corner, then you hoover over the web page and you see elements turn blue, if you click on any element you will see in the Elements tab the relevant tag and you will see the id, that's how I found these id's. Je bent welkom ;)

这篇关于创建书签以填写表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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