JavaScript | And it begins...

/ 10 Aug 2013 /
So, I decided to go back to JavaScript, and I am so glad I did, I watched one tutorial on Youtube, and remembered everything I needed, and I even learn a couple more things, such as 'getElementById' which is so BLOODY cool, so I made this little thing, I also made a few calculators, but they're just simple ones, here's the simple search function:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <html>
   <head>

  </head>
  <body>
   <script type="text/javascript">
/* Creating a function called goTo() with 0 parameters */
function goTo()
{ 
 /* Telling the function to get what ever is in the 'link_id'
    and add 'http://' to the begining of it, the make it into
    a link, for the button below, 'Search', to function as a search
    button. */
    location.href = 'http://' + document.getElementById('link_id').value; 
}
 </script>

<h2> Search box </h2>
<!-- Connecting the goTo() Function with the text box below, 
  so it will fetch the input typed in. -->
<input type='text' id='link_id'> 
<!-- Creating a button that when click, does the onClick function
  and has the text, 'Search'. -->
<input type='button' value='Search' onClick='goTo(); return false;'>
 </body>
  <html>
 
Copyright © 2010 M(ath)+me, All rights reserved