DOM: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
Jka (talk | contribs)
mNo edit summary
Jka (talk | contribs)
mNo edit summary
Line 1: Line 1:
= Document Object Model=
= Document Object Model=


Line 17: Line 16:


</pre>
</pre>
Now  when you see the link it should link to http://msdn.com even though the original href points to www.yahoo.com

Revision as of 12:54, 29 September 2007

Document Object Model

all elements in a html page can have an id and be altered .

Here's how to grab the element by the id and change it using javascript:



<a id="link" href="http://www.yahoo.com">testing</a>

<script type="text/javascript">
 link=document.getElementById('link');
  link.href="http://msdn.com";
</script>


Now when you see the link it should link to http://msdn.com even though the original href points to www.yahoo.com