以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 SVG/GML/VRML/X3D/XAML 』 (http://bbs.xml.org.cn/list.asp?boardid=21) ---- 请问一下,在图上能不能出现提示信息啊? (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=42230) |
-- 作者:abis -- 发布时间:1/12/2007 2:43:00 PM -- 请问一下,在图上能不能出现提示信息啊? 做一个地图的,鼠标放上去,会出现某某村字样,谢谢 俺用inkscape做的图! |
-- 作者:tamefox -- 发布时间:1/14/2007 9:25:00 AM -- 得编写Javascript程序才能实现 |
-- 作者:abis -- 发布时间:1/14/2007 4:49:00 PM -- 能给一些具体的代码和实现方法吗 |
-- 作者:tamefox -- 发布时间:1/15/2007 9:54:00 AM -- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd"> <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"> <desc> <!-- put a description here --> </desc> <script type="text/javascript"> function showInformation(evt){ var txt; txt="This is a "+evt.target.tagName; var nodeGroup=document.getElementById("label"); nodeGroup.setAttribute("transform","translate("+parseInt(evt.screenX+5)+","+parseInt(evt.screenY+1)+")"); nodeGroup.setAttribute("visibility","visible"); var nodeTxt=document.getElementById("txt"); nodeTxt.firstChild.nodeValue=txt var nodeBg=document.getElementById("bg"); nodeBg.setAttribute("width",nodeTxt.getComputedTextLength()); } function hideInformation(){ var node=document.getElementById("label"); node.setAttribute("visibility","hidden") } </script> <g onmouseover="showInformation(evt)" onmouseout="hideInformation(evt)"> <!-- your graphic here --> <rect x="80" y="80" width="45" height="45" fill="blue" stroke="red"></rect> <circle cx="150" cy="150" r="25" fill="red" stroke="blue"/> </g> <g id="label" visibility="hidden"> <rect id="bg" fill="yellow" stroke="black" width="10" height="10"/> <text id="txt" y="8">a</text> </g> </svg> |
-- 作者:damy -- 发布时间:4/3/2008 9:11:00 PM -- 楼上的tamefox太厉害了.佩服佩服! |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
46.875ms |