Javascript jsp page Dynamic Display System Time Test available Multi-browser pass test (2), javascriptjsp
<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
JSP page dynamic display time
The getTime () function defined in script code is not called. Of course it will not be displayed.
If you want to keep Dynamic Display during page loading, you can add
Window. onload = function () {// window is a browser window object and does not need to be created using new
// Onload is an event automatically executed during page loading.
// Here an anonymous function is called without a function name.
Window. setInterval ("getTime ()", 1000); // execute your getTime () function every MS
// SetInterval is a common method of window, indicating the interval at which a function is executed
}
JSP is different from javascript in different browsers. How can we test it?
There is no accuracy. Nowadays, browsers of various vendors are quite different. When writing code, we should always consider these things. Some things are different, and no company can unify the world, therefore, it is hard for our developers. If users require different browsers, our test cases will grow exponentially.
First, I determined the browser I needed, and found their differences around these browsers (this is from the experience accumulated by my predecessors, Google), and gradually summed up my experience, there is no way to handle different statement blocks separately.
If you really want to block this difference, well, use the framework, the latest version of the framework, such as jquery, extjs, dwr, and learn to use these frameworks, you should be able to meet your requirements.