我目前有一个问题: scan image, create links from content (php hopefully)
由于我在ms发布商工作,我可以删除地图图像并保留#d框。将那些保存为.htm我最终得到以下代码:
<!--[if gte vml 1]><![if mso | ie]><v:shape id="_x0000_s1039" type="#_x0000_t201" style='position:absolute;left:311.27pt;top:110.81pt;width:11.34pt;height:9pt; z-index:7;mso-wrap-distance-left:2.88pt;mso-wrap-distance-top:2.88pt; mso-wrap-distance-right:2.88pt;mso-wrap-distance-bottom:2.88pt' stroked="f" strokecolor="black [0]" insetpen="t" o:cliptowrap="t">
<v:stroke color2="white [7]">
<o:left v:ext="view" color="black [0]" color2="white [7]" weight="0"/>
<o:top v:ext="view" color="black [0]" color2="white [7]" weight="0"/>
<o:right v:ext="view" color="black [0]" color2="white [7]" weight="0"/>
<o:bottom v:ext="view" color="black [0]" color2="white [7]" weight="0"/>
<o:column v:ext="view" color="black [0]" color2="white [7]"/>
</v:stroke>
<v:shadow color="#ccc [4]"/>
<v:textbox inset="0,0,0,0">
</v:textbox>
</v:shape><![endif]><![endif]-->
<table v:shapes="_x0000_s1039" cellpadding=0 cellspacing=0 width=15 height=12 border=0 dir=ltr style='width:11.34pt;height:9.0pt;border-collapse:collapse; position:absolute;top:110.81pt;left:311.27pt;z-index:7'>
<tr>
<td width=15 height=12 bgcolor=white style='width:11.3385pt;height:9.0pt; padding-left:.1417pt;padding-right:.1417pt;padding-top:.1417pt;padding-bottom:.1417pt;background:white;border:solid blue .25pt'>
<p class=MsoNormal style='text-align:center;text-align:center'><span lang=en-US style='font-size:5.0pt;font-family:Arial;language:en-US'><span dir=ltr></span>185</span></p>
</td>
</tr>
</table>
我正在寻找(如上一个问题所示)从单元格中的#创建链接(在这个例子中它是185.我有太多不能手动执行此操作,所以我正在搜索有关使用代码执行此操作的方法。
我发现这个代码使用jQuery,它应该从以下文本中获取文本:
$('#myTable tr').each(function() {
var
$tds = $(this).find('td');
if($tds.length != 0) {
var
$currText = $tds.eq(0).text();
alert('Curr Source Language: ' + $currText);
}
});
我不太确定如何实现上面的jQuery。我希望整个表格成为一个链接(不仅仅是内部的#)。因此,如果'获取文本'有效,那么我想用以下内容包装整个表: -- everything inbetween as above code --
我希望这有点道理。感谢您的任何建议。
答案 0 :(得分:0)
您需要一种使用lang=en-US
作为选择器来查找表格中的值的方法。
然后你需要建立一个网址并更改页面
$(function (){
// Assign click event on any table
$('table').click(function(){
// Get Value
var val = $(this).find('[lang=en-US]').text();
// Change Page
window.location.href = "http://gotothislink_" + val + ".jpg"
});
});