Reputation: 61
Premise: I've started to study javascript and the DOM and I have this HTML fragment:
<body>
<div id="Area_T10" class="abAdArea">
<script src="http://ad.dc2.adtech.de/addyn/3.0/831/***1644116***/0/744/ADTECH;" language="javascript1.1" type="text/javascript"></script>
<script>
** -- My script var n = **
</script>
</div>
</body>
I want to retrieve the number "16644116" from the div
but I cannot figure out how to do it.
Can you help?
Best Regards.
Domenico
Upvotes: 1
Views: 114
Reputation: 30990
I am assuming you want to extract the number from the script source URL.
First step, get the script source value:
var src = document.getElementsByTagName('script')[0].src;
Then, if you're familiar with regular expressions, you should be able to create a pattern to extract that value.
Upvotes: 1
Reputation: 48369
Upvotes: 0