我所读到的都说要使用 element em > 属性, 但在我的状态下似乎没有效果。 我试图解析数字 : 629216818, 并将其设置为 varialbe: fbid 。 这是一个 Greasemonkey 脚本, 这样 HTML 无法直接编辑 。 我不行, 所以我可能只是做一些愚蠢的事情, 但这里是我的 HTML 和 Javascript :
<div id="petRightContainer">
<a title = "Pet trainer bonus: Your companion will level 5% faster." href="setup.php?type=companion>Random=8167343321487308">
<div class="petRight" style="background-image:url(/fb/res/gui4/companion/cu_sith.jpg)"></div>
</a>
<div class="petRightLevel">
<a href="#" onClick="publishToWall( http://www.ghost-trappers.com/fb , Look at the cool augmentations my companion has received on Ghost Trappers. , Look at my new companion on Ghost Trappers! I ve named it Jankie. , null, index.php?si=629216818&fromWall=1 , white/companion_32.jpg , companion/wallpost_augmentation_12.jpg , companion/wallpost_augmentation_21.jpg , companion/wallpost_augmentation_11.jpg , null)">Dog</a>
</div>
等
<script type="text/javascript">
fbid = 0;
fbidRegex = /d{3,}(?=&fromWall=1)/;
if ( document.getElementsByClassName("petRightLevel")[0]){
element = document.getElementsByClassName("petRightLevel")[0].firstChild;
codeStore = element.onclick;
fbid = fbidRegex.exec(codeStore);
document.write("it is working ");
}
document.write(fbid);
</script>