首页 > 其他分享 >面试题及相关参考答案

面试题及相关参考答案

时间:2022-11-28 15:33:59浏览次数:34  
标签:面试题 csharpcode background color rgba 相关 96 参考答案 255

1、页面关闭之前执行js.(使用了js的onunload事件)
demo1:   
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
   <title>onunload测试</title>
   <script>
   function checkLeave(){
    alert("欢迎下次再来!");
在这里可以写你要执行的那个函数
   }
   </script>
   </head>
   <body onunload="checkLeave()">
   </body>
   </html>
demo2:

判断是刷新还是离开:
<HTML>
<HEAD>
<TITLE>判断是刷新还是关闭</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="onunload">
<META NAME="Description" CONTENT="test js onunload event">
</HEAD>
<script>
function CloseOpen() {
if(event.clientX<=0 && event.clientY<0) {
alert("关闭");
}
else
{
alert("刷新或离开");
}
}
</script>
<body onunload="CloseOpen()">
</BODY>
</HTML>
2、当jsp页面完全加载完成后执行一个js函数(使用onload事件,js里有多种写法,了解一下)
方法1.如下程序,当页面完全加载后执行openTheIndexPage()方法
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Telecommunications Data Collection System</title>
<script type="text/javascript" src="<%=contextPath%>/js/baseframe.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/cookies.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/tag/tag.js"></script>
<script language="javascript" for="window" event="onload">
function openTheIndexPage() {
openMyURIWithCid(true, 'root', 'IDX', "iframe/dispatch.jsp?url=tdc/zhk/impctrlobjinf/index/index.jsp", '首页',
'top.tagmenu', 'top.maintop', true,
'system/accessPaths.do?currentModuleCode=IDX',
'mainmenu', true);
};
if(document.readyState=="complete"){
openTheIndexPage();
}
</script>
</head>
<body>
</body>
</html>
方法2:可以是以下几种,但是效果不如方法1.
<body onl oad="function name()"> </body > 
<script>window.onload=function name </script>
<script language="javascript" for="window" event="onload">function name(); </script>
方法3:<body onl oad="xxx()"> </body> xxx()为你要执行的函数
.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }补充:
<script language= "javascript " for= "window " event= "onload " /> 的问题解读
EVENT event 设置或获取脚本编写用于的事件
FOR htmlFor 设置或获取绑定到事件脚本的对象。
<script   language= "javascript "   for= "window "   event= "onload ">
.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }相当于
<script   language= "javascript "> 
// 绑定
window.attachEvent( "onload ",function() {
})
</script>
3、js更改class
html:

<div id="a" class="dbl"> a content </div>
<div id="b" class="dno"> b content </div>
<div id="c" class="">c content</div?

css:
<style type="text/css">
.dbl{display:block;}
.dno{display:none;}
</style>

js:

<script language="javascript">
document.getElementById("a").onmouseover = function(){
document.getElementById("a").className = "dno";
document.getElementById("b").className = "dbl";
}
document.getElementById("b").onmouseout = function(){
document.getElementById("a").className = "dbl";
document.getElementById("b").className = "dno";
}

</script>

注意:js要放在最后面,css,html的位置随便

补充:

function change(obj,cal){

var ok;
if(document.all)
{ ok=obj.getAttribute("className")';
}//for IE
else
{ ok=obj.getAttribute("class");
}//for FF
obj.className=ok;

}

 

更改其它属性:.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
<div>
<a href="javascript:changeBody(1)">模块A</a>
<a href="javascript:changeBody(2)">模块B</a>
<a href="javascript:changeBody(3)">模块C</a>
</div>

<div style="display: none" id="iDBody1"></div>
<div style="display: none" id="iDBody2"></div>
<div style="display: none" id="iDBody3"></div>.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
function changeBody(index){
switch(index){
case 1:{
document.getElementById('iDBody1').style.display = "";
document.getElementById('iDBody2').style.display = "none";
document.getElementById('iDBody3').style.display = "none";
} break;
case 2:{
document.getElementById('iDBody1').style.display = "none";
document.getElementById('iDBody2').style.display = "";
document.getElementById('iDBody3').style.display = "none";
} break;
case 3:{
document.getElementById('iDBody1').style.display = "none";
document.getElementById('iDBody2').style.display = "none";
document.getElementById('iDBody3').style.display = "";
} break;
}
}.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }

 

参考资料:
5、更改tomcat接收请求的线程数


更改CATALINA_HOME(tomcat安装目录)/conf/server.xml文件中的以下节点中的maxThreads属性的值即可

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxThreads="800" acceptCount="1000"/>.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
相关信息:
tomcat6.x中Servlet容器的结构:
Server(容器)下有一个或多个Service,Service下有一个或多个Connector、一个engine,一个engine可以有多个host(虚拟主机,可以配域名和别名,可以决定是否识别新添加的web项目),一个host中可以包括多个Context(web应用程序)

maxThreads:tomcat起动的最大线程数,即同时处理的任务个数,默认值为200
acceptCount:当tomcat起动的线程数达到最大时,接受排队的请求个数,默认值为100

这两个值如何起作用,请看下面三种情况
情况1:接受一个请求,此时tomcat起动的线程数没有到达maxThreads,tomcat会起动一个线程来处理此请求。
情况2:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,tomcat会把此请求放入等待队列,等待空闲线程。
情况3:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,等待队列中的请求个数也达到了acceptCount,此时tomcat会直接拒绝此次请求,返回connection refused


6、java和c#将String逐字母输出示例:
java:

public static void main(String[] args) {
// TODO Auto-generated method stub
String str="Chinese123";
for (int i = 0; i < str.length(); i++) {
System.out.println(str.charAt(i));
}

char[] charArray=str.toCharArray();
for (int i = 0; i < charArray.length; i++) {
System.out.println(charArray[i]);
}
}

c#:

static void Main(string[] args)
{
String str = "Chinese123";
for (int i = 0; i < str.Length; i++)
{
Console.WriteLine(str[i]);
}
Console.ReadKey();
}

7、



 

 

待续......................



标签:面试题,csharpcode,background,color,rgba,相关,96,参考答案,255
From: https://blog.51cto.com/u_15147537/5891364

相关文章

  • Extjs相关知识点梳理
     store是一个为Ext器件提供record对象的存储容器,行为和属性都很象数据表方法:不列举继承来的方法Store(Objectconfig)构造,config定义为{autoLoad:B......
  • 专利相关
      ​​http://www.cnipr.com/​​​​http://www.izhiliao.com.cn/​​  ​​http://www2.soopat.com/​​ 微软与众多Android厂商签署了专利授权协议,但从来没有公开它......
  • SpringCloud面试题
    1Springcloud核心组件及其作用1.1Eureka:服务注册与发现注册:每个服务都向Eureka登记自己提供服务的元数据,包括服务IP地址,端口号,版本号,通信协议等。eureka将各个服务维......
  • 单链表面试题
    单链表的面试题1.求单链表中的有效节点的个数/****@paramheroNode链表的头结点*@return返回的就是有效节点的个数*/publicstat......
  • Pandas中你一定要掌握的时间序列相关高级功能 ⛵
    ......
  • 利用 lapack 函数 dsyev 去线性相关
    我们经常遇到线性相关的情况,如果\[c_1|1\rangle+c_2|2\rangle+\cdots+c_n|n\rangle=0,\]有\(\{c_1,c_2,\cdots,c_n\}\)的非零解,则称\(\{|1\rangle,\c......
  • 【06.14】西安市 “机器听觉”相关嵌入式岗位推荐
    朱老师推荐语:此岗位是朱老师同学提供的工作推荐,融资了两轮,最近在招嵌入式相关的人,待遇还算不错,条件不高,同学们可以考虑,尤其是想到西安发展的。。你如果不找工作那就看看而已......
  • 肖sir___阿里面试题__笔试题
    身份证:330184198903193110籍贯:浙江省杭州市余杭区良渚街道之前薪资12K期望薪资13K最近公司地址:杭州市西湖区文一西路522号(杭州百图科技有限公司)之前公司地址:杭州市拱墅区赵......
  • 作用域和闭包常见的面试题
    作用域和闭包常见的面试题作用域变量提升varscope="global";functionscopeTest(){console.log(scope);varscope="local"}scopeTest();//undefined......
  • 20220615 Servlet 相关的 Spring Boot 自动配置类
    自动配置类Servlet相关的匹配的自动配置类:org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfigurationorg.springframework.boot.autoc......