473,394 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

javascript scripts

6
hello

I would like to hit a keyboard shortcut
and parse the current webpage and then do stuff in the
webpage (eg autosave links that contain a specific
string, autosave images, autoclick specific buttons
etc etc)

can you tell me how to do that?

I use Opera Browser

thanks
Mar 27 '07 #1
11 1779
acoder
16,027 Expert Mod 8TB
Welcome to TSDN.

For keyboard shortcuts, see this example. It gives you the keycode of the key pressed. You can also see this ref. for alt/shift/ctrl keys.

You can simulate button clicks with the click() method, see link.
Mar 28 '07 #2
colore
6
thanks

can you give me a guided example of a script that will recognize a button and click it whenever it appears (whenever I visit a webpage that it contains it) ?

thanks
Mar 29 '07 #3
acoder
16,027 Expert Mod 8TB
You could look for all input elements:
Expand|Select|Wrap|Line Numbers
  1. var allInput = document.getElementsByTagName("input");
and check for their type. If it's button, then call the click() method.
Mar 29 '07 #4
colore
6
ummm

can you tell me the script that whenever I visit google.com it will autoput "something" inside the search form, it will select and then it will autoclick the "I am feeling lucky button" ?

thanks
Mar 30 '07 #5
acoder
16,027 Expert Mod 8TB
Look at the source code of the page. Find the name or id of the search box and likewise for the button. Then it should be trivial to set the value and click the button respectively.
Mar 30 '07 #6
colore
6
Look at the source code of the page. Find the name or id of the search box and likewise for the button.
this is the easy part...

Then it should be trivial to set the value and click the button respectively.
this is the hard part... :S

can you give me an example?
Mar 31 '07 #7
acoder
16,027 Expert Mod 8TB
Say the id is "searchbox", then:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("searchbox").value='the value to set';
If the id for the button is "searchButton", then to click:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("searchButton").click();
Mar 31 '07 #8
colore
6
thanks much appreciated

so to autoclick google search button whenever I visit google.com, I should use this script:

Expand|Select|Wrap|Line Numbers
  1. document.addEventListener('DOMContentLoaded',function() {
  2. document.getElementById("btnG").click();
  3. }
but it doesnt work :s
Mar 31 '07 #9
acoder
16,027 Expert Mod 8TB
Is this Google page in an iframe? You need to access the iframe first, see this page.
Apr 2 '07 #10
colore
6
Is this Google page in an iframe? You need to access the iframe first, see this page.
no its the simple www.google.com webpage
Apr 2 '07 #11
acoder
16,027 Expert Mod 8TB
no its the simple www.google.com webpage
Well, in that case, it shouldn't be possible, but since you're using Opera, you can use something called User Javascript, see link.
Apr 2 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Web Spinner | last post by:
I am running Windows 2000 and I can't seem to get my JavaScript working with ASP. I placed my HTML code in a file called x.asp under c:\Inetpub\wwwroot, and I placed my JavaScript code in a file...
3
by: Plamen Valtchev | last post by:
This is my problem: From JavaScript I want to find the list of all defined/loaded JavaScript functions/objects/names within the current scope (html page in a browser). the page could contain...
15
by: Davide R. | last post by:
Ciao a tutti, vi spiego il mio problema Ho una pagina HTML che referenzia un CSS esterno. Ho alcuni elementi HTML che appartengolo ad una classe (chiamiamola "class1"). Avrei la necessitą,...
6
by: Dan Webb | last post by:
Hi All, Im currently working on ways of pacakaging javascript functions/variables/objects in a similar way to the Java package statement so that scripts can be interact with each other with the...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
2
by: New User | last post by:
I have a System.Web.UI.UserControl as custom control and I have a javascript block for user control. The problem is I want to bring src attribute from outside as property or other method. e.g...
7
by: unacoder | last post by:
Is it possible to request the user's permission to be able to control IE or FireFox windows that are pointed to domains other than the base domain the script is running from? For example, if my...
31
by: drclue | last post by:
Would you like to display the weather, stocks,movie listings or perhaps send someone an SMS text message or fax? Did you think Google or Yahoo maps was cool? No matter the back end or...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.