onmousemove="alert('hello')"或者onmousemove='alert("hello")'都可以

解决方案 »

  1.   

    document.write("<div onmousemove=\"alert('hello')\">...</div>");
      

  2.   

    var  a  =  ["red",  "yellow",  "blue",  "green",  "purple","orange"];  
    var str="hello" 
    document.write(" <div onmousemove='alert('hello'+"+str+")' style='background-color:"+a[Math.round((Math.random()*5))]+"'> " +a[0]+" </div>") 
    第一个问题红色部门解决了新的情况:里面有变量怎么处理, 红色部分该怎么写?如果多重影号下多个变量怎么处理
      

  3.   

    str="hello"
    document.write("<div onmousemove=\"alert('hello" + str + "')\">... </div>");