案例:javascript案例     状态:可编辑再运行    进入横版
x
  x="<a href='http://www.microsoft.com' target='_blank'>microsoft</a>";
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p>点击这个按钮,获得随机链接。</p>
6
7
<button onclick="myFunction()">点击这里</button>
8
9
<p id="demo"></p>
10
11
<script>
12
var rand = {};
13
rand.get = function (begin,end){
14
 return Math.floor(Math.random()*(end-begin))+begin;
15
}
16
17
var x = rand.get(1,3)
18
function myFunction()
19
{
20
if (x==1)
21
  {
22
  x="<a href='/' target='_blank'>W3xue.com</a>";
23
  }
24
else

 运行结果 
 北美留学生论坛