473,657 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading data from HTML page

hsn
237 New Member
hey everyone

i am currntly working on a project. for a function that i want to create there are too many methods to solve it. one of these methods that i am thinking of is to write a javascript function to read an HTML webpage, then to go to a text field next to (for example First Name label). the function should check the data in the text field if it is not correct it should correct it and then press the submit button at the end of the HTML webpage.

could this function be done? at what functions i could use to do it??

thanks for reading my question

regards

hsn
Mar 29 '08 #1
10 1803
hsn
237 New Member
guys
can't anyone help me with this problem
i just want to know is it doable or not. and some tips

thanks


hsn
Mar 30 '08 #2
hsriat
1,654 Recognized Expert Top Contributor
Are not you asking for JavaScript Validation?
Mar 30 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Is this HTML page the current page? If not, is it from the same domain?
Apr 1 '08 #4
hsn
237 New Member
Is this HTML page the current page? If not, is it from the same domain?
thanks acoder for replying
yes it is the current page and it is the same domain.

regards
hsn
Apr 5 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
From what you've described, it does look like form validation.

You can loop over input form elements on a page with document.getEle mentsByTagName( "input"). This will give you an array of input elements which you can loop over using a for loop.

If you want to read the whole body, document.body,i nnerHTML (or some DOM methods) would give you the content of the whole body.

I'm not sure what you mean by correcting. How would you know how to correct, e.g. if the first name hasn't been filled in, what are you going to put in its place?
Apr 5 '08 #6
hsn
237 New Member
From what you've described, it does look like form validation.

You can loop over input form elements on a page with document.getEle mentsByTagName( "input"). This will give you an array of input elements which you can loop over using a for loop.

If you want to read the whole body, document.body,i nnerHTML (or some DOM methods) would give you the content of the whole body.

I'm not sure what you mean by correcting. How would you know how to correct, e.g. if the first name hasn't been filled in, what are you going to put in its place?
what i mean by correcting... the text field should be fi
lled with an IP address of something. in the code the IP is predefined. so if the ip is wrong then change it to the correct one.
after that i have to press the save button on the page.
you have to know that the page is not my page. so i don't know the names of the fields and i don't know how to press the save button at the end of the page

thanks for helpping me

hsn
Apr 5 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
If it's not your page, how are you going to add the code? Using Greasemonkey?

If you know which field number it is, then getting the field value should not be a problem. Say it's the first field, then
Expand|Select|Wrap|Line Numbers
  1. var field = document.getElementsByTagName("input")[0];
  2. var value = field.value;
will give you the field and value.

To click a button, use the button's click() method.
Apr 5 '08 #8
hsn
237 New Member
If it's not your page, how are you going to add the code? Using Greasemonkey?

If you know which field number it is, then getting the field value should not be a problem. Say it's the first field, then
Expand|Select|Wrap|Line Numbers
  1. var field = document.getElementsByTagName("input")[0];
  2. var value = field.value;
will give you the field and value.

To click a button, use the button's click() method.
thanks alot m8

hsn
Apr 5 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. I'm assuming that solved your problem.
Apr 5 '08 #10

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

Similar topics

7
8451
by: Matt Daleo | last post by:
I'm attempting to read a remote file and parse it for data. The problem I'm having is that the file seems to be generated by Perl (http://alert.dot.pima.gov/scripts/1brpssd.pl) and when I read it the script-generated data is not displayed. When I view the page with a browser the data is displayed just fine. I've tried using the built-in PHP commands to read the file (file, fget) as well as the all of the Snoopy "fetch" classes...
7
7086
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and disadvantages of using a MySQL blob field rather than reading the images directly from the file? How does one insert an image into a blob field? Can it be done dynamically? Thank you John
7
10576
by: jeff | last post by:
Hi. I am trying to read addresses from an Exchange 5.5 Global Address Book from an asp.net page. When the page executes the error "Collaboration Data Objects - ]" is generated. Here is the code: Dim strProfileInfo As String Dim ObjSession As New MAPI.Session
6
3784
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am trying to read a flatfile. In COBOL, my simple file layout and READ statement would look like below. Question: what is the standard, simple coding convention for reading in a flatfile - one record at a time?? SCANF does not work because of...
5
3725
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button. When the user clicks the "Add another email" it will call a client side JavaScript function, add_email, which will dynamically add a new set of controls to the webpage using the innerHTML method. It appears to work perfectly fine in the browser. The...
3
2081
by: Rick | last post by:
I have a base class that inherits from System.Web.UI.Page that I need to include the ability to read the inheriting class/page meta tags. I can't find any methods in the System.Web.UI.Page members that provide access to do this. What is the practice to read meta information from the head section of an ASP.NET page? I am using VS.NET 1.1 C# (VB is fine).
6
2606
by: Ven | last post by:
Hi, I am reading a kind of below mentioned raw data into my C++ program and writing it out but I want this to be converted into EBCDIC format, how can I accomplish this ? Right now I am using the following code ifstream Source("source_file"); ofstream Dest("dest_file");
12
2886
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my workstation it works fine, but when I publish the page on our DEV server it doesn't fine the CSV file from the client. Has anyone done this before? If so, how do I do it? I'm new to ASP.net so
0
2080
by: panos100m | last post by:
Hi i can read everything from my xml file except a part that i can always get teh first items of each category (it will make more sence in a sec) So here is my xml <?xml version="1.0" encoding="UTF-8"?> <flashxml> <second_page> <sp text="ss ptextj"/>
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.