我在网页上有这个 html:
<select name="chapter_select" class="chapter_select">
<option value="http://www.example.com/chapter/1">Chapter 1</option>
<option value="http://www.example.com/chapter/2">Chapter 2</option>
<option value="http://www.example.com/chapter/3">Chapter 3</option>
<option value="http://www.example.com/chapter/4">Chapter 4</option>
<option value="http://www.example.com/chapter/5">Chapter 5</option>
<option value="http://www.example.com/chapter/6" selected="selected">Chapter 6</option>
</select>
而这个变量:
getInformationsFromCurrentPage : function(doc, curUrl, callback) {
//This function runs in the DOM of the current consulted page
var curChapName = $("select.chapter_select:first option:selected", doc).text();
var chapurl = $("select.chapter_select:first option:selected", doc).val();
callback({"name": name,
"currentChapter": curChapName,
"currentMangaURL": nameurl,
"currentChapterURL": chapurl});
},
}
问题是两者都返回相同的文本值。chapurl 应该返回 url,而不是文本值。这一直有效,直到网站修改了他们的网站。
我知道我会很挑剔,但这是开发扩展的手册,并且 doc 变量是必须的http://www.allmangasreader.com/dev.php只需注意 getInformationsFromCurrentPage 函数。它使用的是 jQuery 1.4.2,所以可能就是这样,奇怪的是其他网站也可以正常工作。
更新:服务器正在使用脚本(重写 html)让我认为下拉列表在顶部。我使用了一些选择器来获取源代码之后的正确选择器。