By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Help with getting data from a webpage

P: 5
I am trying to write a javascript bookmarklet that will pull data from a webpage. The webpage in question comes pre-filled with info. I know what element and form numbers are tied to the field that I want to pull data from. How would I write a bookmarklet to harvest the data? The bookmarklet would be used in conjunction with a scripting program but I have a way to get the data from javascript into the script so don't worry about that part.

I have found this code elsewhere... it does what I need but it also provides too much info:
Expand|Select|Wrap|Line Numbers
  1. javascript:function ROIoiW(){var i=0,j,D,E,F=document.forms,DD="",m,M; while(i<F.length){E=F[i].elements;for(j=0;j<E.length;j++){ D=E[j];m=i+'/'+j+'/'+D.type+'-''-''-'+D.value+'\n'; M=M+m;DD=DD+m+'<br>'}i++} document.write(DD);}ROIoiW();void(null)
this displays form/element/description-value. All I need is a fucntion that will return a value for a specified form and element.

Can someone help please?
Jan 31 '08 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 15k+
P: 16,027
Welcome to TSDN!
All I need is a fucntion that will return a value for a specified form and element.
Expand|Select|Wrap|Line Numbers
  1. document.forms[specifiedForm].elements[specifiedElement].value;
Jan 31 '08 #2

P: 5
sweet! thanks a lot! works like a charm! I don't know javascript as well as i would like... sigh, all a matter of time
Jan 31 '08 #3

Expert Mod 15k+
P: 16,027
Glad it helped. If you want some good JavaScript tutorials/references, check out the Offsite Links sticky thread at the top of this forum.
Jan 31 '08 #4

Post your reply

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