sarsar
sarsar

Reputation: 1561

using javascript to grab javascript/cdata in html

what is the best way to grab the memberId from this data and show it in an alert() dialog?

I would like to make this a bookmarlet something like this:

javascript:alert("member ID is\n"+document.getElementsByName("memberid")[0].value);

(This doesnt work; it's just an example.)

<script type='text/javascript'> 
  //<![CDATA[
    var _SKYAUTH = {
      loginUrl:'',
      memberNick:'',
      memberId:'233669',
      profileUrl:'',
      photoUrl:''
    };
  //]]>
</script> 

Upvotes: 0

Views: 127

Answers (1)

Pekka
Pekka

Reputation: 449425

i want to make a bookmarlet

You should be able to catch the variable using

alert(_SKYAUTH.memberId);

Upvotes: 1

Related Questions