<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language=javascript>
var theOldString
var theNewString
function searchText(theString)
{
var myTextRange=document.body.createTextRange();
if (myTextRange.findText(theString))
myTextRange.select();
else
alert("no fund")
}function getTheText()
{
theOldString=prompt("要查找的内容","");
if(theOldString!="")
searchText(theOldString);
}function replaceTheText()
{
if(theOldString=="")
alert("请先进行查找");
else
{
theNewString=prompt("替换为","");
if(theNewString!="")
var myTextRange2=document.selection.createRange();
myTextRange2.text=theNewString;
}
else
alert("请输入替换内容")
}
}
</script>
<body id="mybody">
<p><a href="#" onclick="getthetext()">hhhhhhhhhhhhhhhhhhh </a> </p>
<p> </p>
<p><a href="#" onclick="replaceTheText()">54545454545 </a></p>
<pre id="mypre">
李折叠式井架
</pre>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language=javascript>
var theOldString
var theNewString
function searchText(theString)
{
var myTextRange=document.body.createTextRange();
if (myTextRange.findText(theString))
myTextRange.select();
else
alert("no fund")
}function getTheText()
{
theOldString=prompt("要查找的内容","");
if(theOldString!="")
searchText(theOldString);
}function replaceTheText()
{
if(theOldString=="")
alert("请先进行查找");
else
{
theNewString=prompt("替换为","");
if(theNewString!="")
var myTextRange2=document.selection.createRange();
myTextRange2.text=theNewString;
}
else
alert("请输入替换内容")
}
}
</script>
<body id="mybody">
<p><a href="#" onclick="getthetext()">hhhhhhhhhhhhhhhhhhh </a> </p>
<p> </p>
<p><a href="#" onclick="replaceTheText()">54545454545 </a></p>
<pre id="mypre">
李折叠式井架
</pre>
</body>
</html>
WEB页面上有“首页”“公司介绍”“公司新闻”的字符。
我要用JS将这些都转换成英文。
搞得头都晕了。
请高手帮忙写出实现代码谢谢。
WEB页面上有“首页”“公司介绍”“公司新闻”的字符。
我要用JS将这些都转换成英文。
搞得头都晕了。
请高手帮忙写出实现代码谢谢。
做中英文双语?不是这样个做法啊
另外4楼已经提醒了
<a href="#" onclick="getthetext()">hhhhhhhhhhhhhhhhhhh </a> </p>
是getTheText()