W3Schools 在线编辑工具(TIY) V3.0
编辑的代码:
运行代码 »
©
w3s.com.cn
运行结果窗口大小:
300 x 150
<
html
>
<
body
>
<
form
id
="form1"
>
<
input
type
="checkbox"
id
="check1"
/
>
<
/form
>
<
p
>
The form containing the checkbox is:
<
script
type
="text/javascript"
>
x=document.getElementById(
'check1'
);
document.write(x.form.id);
<
/script
>
<
/p
>
<
/body
>
<
/html
>
<html> <body> <form id="form1"> <input type="checkbox" id="check1" /> </form> <p>The form containing the checkbox is: <script type="text/javascript"> x=document.getElementById('check1'); document.write(x.form.id); </script></p> </body> </html>