这可能听起来像一个新手问题,但我想知道当有人使用鼠标在页面上选择给定的文本片段时,我如何触发自定义JavaScript函数.还有什么方法可以在网页上找到所选文字的位置?
更新:为了更清楚,文本片段可以是句子或单词或短语或整个段落的一部分.
我试图解析来自Savon SOAP api的SOAP响应
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getConnectionResponse xmlns:ns="http://webservice.jchem.chemaxon">
<ns:return>
<ConnectionHandlerId>connectionHandlerID-283854719</ConnectionHandlerId>
</ns:return>
</ns:getConnectionResponse>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
我试图使用libxml-ruby而没有任何成功.基本上我想提取标签内的任何内容和connectionHandlerID值.