源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <a id="runoob" charset="ISO-8859-1" href="/">开源教程</a><br> <script> document.write("返回链接的charset: "); document.write(document.getElementById('runoob').charset); document.write("<br><br>"); </script> <a id="google" href="//www.google.com/">Google</a><br> <script> document.getElementById('google').charset="utf-8"; document.write("设置链接的charset: "); document.write(document.getElementById('google').charset); </script> </body> </html>
运行结果