1、form中的input有哪些类型?各是做什么处理使用的?
text radio checkbox file button image submit reset hidden
submit是button的一个特例,也是button的一种,它把提交这个动作自动集成了。
如果表单在点击提交按钮后需要用JS进行处理(包括输入验证)后再提交的话,通常都必须把submit改成button, 即取消其自动提交的行为,否则,将会造成提交两次的效果,对于动态网页来说,也就是对数据库操作两次。
button具有name、value属性,能触发onclick事件
submit继承了button
submit增加了触发表单onsubmit事件的功能、增加了执行表单的submit()方法的功能
INPUT type=submit按回车提交表单
button提交的是innerTEXT
2、table标签中border,cellpadding td标签中colspan,rowspan分别起什么作用?
border边界
cellpadding边距
cellpadding,是补白,是指单元格内文字与边框的距离
cellspacing,两个单元格之间的距离
colspan跨列数
rowspan跨行数
3、form中的input可以设置readonly和disable,请问这两项属性有什么区别?
readonly不可编辑,但可以选择和复制
disable不能编辑复制选择
4、JS中的三种弹出式消息提醒(警告窗口、确认窗口、信息输入窗口)的命令是什么?
alert
confirm
prompt
5.题目:当点击按钮时,如何实现两个td的值互换?
用javascript实现此功能。
分析:
这个题主要是考变量传值。其次是考如何取元素的值。
第一种代码如下:
Code
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
5<title>无标题文档</title>
6<script type="text/javascript">
7//<![CDATA[
8function submitbtn() {
9
10 var tText1 = document.getElementById('txt1');
11 var SubmitBtn1 = document.getElementById('submitBtn1');
12 var tText2 = document.getElementById('txt2');
13 var SubmitBtn2 = document.getElementById('submitBtn2');
14 SubmitBtn1.onclick = function() {
15 var temp = tText1.value;
16 tText1.value = tText2.value;
17 tText2.value = temp;
18 };
19 SubmitBtn2.onclick = function() {
20 var temp = tText2.value;
21 tText2.value = tText1.value;
22 tText1.value = temp;
23 };
24}
25window.onload = function() {
26 submitbtn();
27}
28//]]>
29</script>
30</head>
31
32<body>
33<input type="text" value="12345666" id="txt1" />
34<input type="submit" id="submitBtn1" />
35<input type="text" value="12345222" id="txt2" />
36<input type="submit" id="submitBtn2" />
37</body>
38</html>
第二种代码如下:
Code
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
5<title>无标题文档</title>
6<script type="text/javascript">
7//<![CDATA[
8function submitbtn() {
9
10 var tText1 = document.getElementById('txt1');
11 var SubmitBtn1 = document.getElementById('submitBtn1');
12 var tText2 = document.getElementById('txt2');
13 var SubmitBtn2 = document.getElementById('submitBtn2');
14 SubmitBtn1.onclick = function() {
15 var temp = tText1.innerHTML;
16 tText1.innerHTML = tText2.innerHTML;
17 tText2.innerHTML = temp;
18 };
19 SubmitBtn2.onclick = function() {
20 var temp = tText2.innerHTML;
21 tText2.innerHTML = tText1.innerHTML;
22 tText1.innerHTML = temp;
23 };
24}
25window.onload = function() {
26 submitbtn();
27}
28//]]>
29</script>
30</head>
31
32<body>
33<table width="200" border="1" cellpadding="0" cellspacing="0">
34 <tr>
35 <td id="txt1">321445</td>
36 <td><input type="submit" id="submitBtn1" /></td>
37 </tr>
38 <tr>
39 <td id="txt2">123133</td>
40 <td><input type="submit" id="submitBtn2" /></td>
41 </tr>
42</table>
43</body>
44</html>
45
6. "闭包"问题
Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
window.onload=function()
{
var ii,a="";
var d=document.getElementsByTagName("DIV");
for(ii=0;ii <d.length;ii++)
{
if(d[ii].id=="top")
{
a=d[ii].getElementsByTagName("li");
for(var i=0;i <a.length;i++)
{
//a[i].onmouseover=function(){show(i)}; //此处的i是一个变量,在运行show取i的值,很显示你的i每次都会最终变成a.length
a[i].onmouseover=new Function("show("+i+")"); //这里的i是一个常量,就是此刻i是值
}
}
}
}
function show(z)
{
alert(z);
}
</script>
</head>
<body>
<div>div1</div>
<div id="top">
<ul>
<li>a</li>
<li>a</li>
<li>a</li>
<li>a</li>
<li>a</li>
</ul>
</div>
</body>
</html>
使用注释行的时候,总是提示5.
在一般编程语言中, 参数都是"传值", 假设一个C函数的原型是int Fun(int value);
当你调用这个函数时, Fun函数首先会在自己的函数栈上copy一份参数, 就是这个函数的副本, 当你在Fun外部修改value值, 并不会影响Fun内部的value.
而Javascript的内嵌函数很特殊, 它并不会copy一个参数副本, 所有函数公用一套参数, 所以你在函数外部修改了参数值, 函数内部也会受影响.
这就是为什么你的show函数, 它的z参数是最后一个值, 因为每一次循环, z都被更改了. 传值和传址的问题
内容正文:1.Write a small JScript to split the following string into two parts and display each part on the console window, the function should return the length of the second part of the string: -
Input string
“Hi: hello.”
Split Char = “:”
The result should output to the screen all the characters on the left side of the “:” and the second line would be all the character on the right side of the “:”
2.IF you saw the following statement in a batch file what would it do?
if /I "%2" EQU "V" goto VALIDATION
1. What do the terms “Filegroups”, “components” and “setup types” mean in Installshield Professional
2. Given a collection of files what process would you go through using the three items detailed in question 1 to produce an installation.
3. What do you understand by the term “Maintenance Mode” with regard to Installshield Professional
4. What is the equivalent of a Component in Installshield Developer.
5. Describe an installation you have written with Installshield Professional – what did it install ? did you use customized dialogues ? if so how did you do this ? did the installation require you to write your own scripted functions ? if so give an example. Did you consider future upgrades of your applications – expand.
6. What do you know about Windows Installer based installations i.e. have you had any exposure to creating them ? if so expand. Where is the installation information held for such an installation ?