Fill fields on a webpage
I've already asked this question, but it's still too unclear to me, and it seems people haven't understood what I'm trying to do, so I'll try and be clearer.
This website: https://www4.polymtl.ca/poly/poly.html is the website I want to fill.
What I would like to be able to do, is modify the values of the "nip", "code", and "naissance" fields with text (for example, code being "majuif").
<input type=password name=code size=8 maxlength=8>
<input type=password name=nip size=8 maxlength=8>
<input type=password name=naissance size=8 maxlength=8>
However, I don't know how to do that. And this is my problem.
Should I write another HTML file - I don't know if the word "macro" can be used for that, but I'm pretty sure it can - and insert JavaScript in it?
Please note that I'm not a professional in JavaScript or HTML, but I have basics, and still lea开发者_如何学Crning.
Thanks,
-Max.
Looked at your other question and you said it is not your page. You can not read or write to a page which is not created by your own page.
You can from your own browser create a shortcut / bookmark link to javascript:alert('hello world'); or
javascript:document.getElementByName('code').value = 'majuif';
document.getElementByName('nip').value = 'majuif';
document.getElementByName('naissance').value = 'majuif';
Then hit the bookmark when you have the page in your browswer.
Update
Checked it needs to be getElementsByName plural but still not happy about their html does not find the input named code - getElementsByTagName works
javascript:document.getElementsByTagName('input')[1].value='code';document.getElementsByTagName('input')[2].value='nip';document.getElementsByTagName('input')[3].value='naissance';alert('tested');
Note you can cut and paste the script into the address bar when you are on the page.
精彩评论