It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Help with search code

Help with search code

Postby mriato on Thu Dec 31, 2009 12:57 am

Hi, I am not a programmer, but have learned a bit of javascript coding and am trying to write a code to help me find if an HTML document has a button element with the word Details on it. Sometimes the page will but sometimes not. If it does, I want the button to be clicked.
Can anyone help or point me in the direction of a piece of code, it is to help me with a job search, help is appreciated.
mriato
 
Posts: 1
Joined: Thu Dec 31, 2009 12:52 am

Re: Help with search code

Postby harrierdh on Thu Dec 31, 2009 2:51 pm

Try this code.

Code: Select all
<input type="button" name="btn" id="btn" value="click" />
<input type="text" name="txt" id="txt" value="" />
<script>
   var t = document.getElementsByTagName("INPUT");
   for (i = 0 ; i < t.length ; i++) {
       alert("type=" + t[i].type + " name=" + t[i].name + " id=" + t[i].id + " value=" + t[i].value);
    }      
</script>
harrierdh
50+ Club
 
Posts: 51
Joined: Wed Dec 16, 2009 7:04 pm


Who is online

Users browsing this forum: No registered users and 2 guests