title: get href of button and img
body: <p>i am no little knowledge about js and html,i have a html like: </p>
  
  <pre><code> &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312" /&gt;
    &lt;title&gt;aa&lt;/title&gt;
   &lt;/head&gt;
  
   &lt;body&gt;&lt;input name="button" type="button" value="hello"    onclick="window.location.href('http://hao.360.cn/')" /&gt;
  &lt;input name="button" type="submit" value="helio" onclick="window.open('http://hao.360.cn/')"/&gt;
  &lt;body bgcolor="#000000"&gt;
  &lt;a href="fg726p.exe"&gt;&lt;img src="a2.jpg" width="156" height="152" border="0" longdesc="eclipse.exe.lnk" /&gt;&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>i want to using js to get respectively the string <a href="http://hao.360.cn/" rel="nofollow">http://hao.360.cn/</a> of the two buttons and  also  get the string fg726p.exe and eclipse.exe.lnk of img? </p>
  
  <p>i want to using the js to get the values for android java methods. i  want to get help. </p>
  
  <p>edit: through some people think it is so basic,butfor me i  know clue to search it 
  can you give me some advice and link</p>
  
  <p>edit2:  i adjust :</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312" /&gt;
  &lt;title&gt;aa&lt;/title&gt;
  &lt;script language="javascript"&gt; 
   function get(){ 
    var xx=document.getElementById("bbs") 
   alert("："+xx.title); 
   } 
   function getElementName(){ 
  var ele = document.getElementById("link1"); 
  alert("：" + ele.href); 
  } 
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;body&gt;&lt;input name="button" id="bbs"   title="http://homepage.yesky.com/59/2673059.apk" type="button" value="hello" onclick="get()" /&gt;
   &lt;input name="button2" type="submit" value="helio" onclick="getElementName()"/&gt;
   &lt;body bgcolor="#000000"&gt;
   &lt;a href="http://homepage.yesky.com/59/2673059.apk"  id="link1"  name="a2"&gt;   &lt;img src="a2.jpg" width="156" height="152" border="0"  onclick="getElementName()" /&gt;&lt;/a&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>i have solved my problem,but i donot know why somepeople post Negative Scores give me for no little js knowledge.may be you know more,think this easy. i only want to
   get  the sting to use,i think if you know more you only answer document.getElementById("link1").href also can help me not give me all the html document. i want to string to use for my android app, i think i donot because the small problem to study the all html. the project not give you more time</p>
  
  <p>edit3:<br>
         var x=document.getElementsByTagName("input");</p>
  
  <pre><code>   var el =x.item(0);
     alert(el.getAttribute("value"));
     alert(el.getAttribute("onclick"));
  
     el =x.item(1);
     alert(el.getAttribute("value"));
     alert(el.getAttribute("onclick"));
  
  
      x=document.getElementsByTagName("a");
     el =x.item(0);
     alert(el.getAttribute("href"));
  
      x=el.getElementsByTagName("img");
     el =x.item(0);
     alert(el.getAttribute("longdesc"));​
  </code></pre>
  
  <p>thank you @jmoreno for this answer for my frist question very good.i put answer here so that prevent the link of he give is broken .</p>