Remove style, javascript, css code from html in asp
asp function code The code is as follows: <% Function RemoveHTML(str) Dim objRegExp, Match,strHTML if isnull (str) then str=”” end if strHTML=str strHTML=replace(replace(replace(strHTML,vblf,””),vbcr,””),vbcrlf,” “) Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = “” strHTML = objRegExp .Replace(strHTML,””) objRegExp.Pattern = “” strHTML = objRegExp.Replace(strHTML,””) objRegExp.Pattern = ” ” strHTML = objRegExp.Replace(strHTML,””) Set objRegExp = Nothing RemoveHTML=strHTML End Function %> The code in php The code is as follows: <?php $search = array (“”si”, // Remove Javascript “”si”, // Remove css “‘<[/!]*?[^]*?>’si”, // Remove HTML tag“‘]*?>’ si”, // Remove comment mark“‘([rn])[s]+’”, // Remove blank characters“‘&(quot|#34);’i”, // Replace HTML entities“‘&(amp|#38);’i”, “‘&(lt|#60);’i”, “‘&(gt|#62);’ i”, “‘&(nbsp|#160);’i”, “‘&(iexcl|#161);’i”, “‘&(cent|#162); ‘i”, “‘&(pound|#163);’i”, “‘&(copy|#169);’i”, “‘&#(d+);’ e”); // Run as PHP code $replace = array (“”, “”, “”, “”, “\1”, “\””, “&”, “<", “>”, ” “, chr(161), chr(162) , chr(163), chr(169), “chr(\1)”); //$document is a string that needs to be processed. If the source is a file, $document = file_get_contents(‘http://www.sina.com.cn’); $out = preg_replace($search, $replace, $document); echo $out; ?> Save it as get.php.
Parse DHTML, JavaScript, DOM, BOM and WEB standard descriptions
DHTML:It is not a new language, but the product of the combination of HTML, CSS and Javascript. DHTML contains the following three meanings: ( 1) Mark the web page into various elements through HTML (2) Use CSS to design the layout style between elements and control the position of each tag (3) Use js to control each tag Javascript consists of three parts: (1) ECMAScript is a scripting programming language standardized by the European Computer Manufacturers Association (ECMA) through ECMA-262. ECMAScript defines all features, objects and methods of a scripting language, and other languages can implement ECMAscipt as a baseline for their functionality. ECMAscript includes Javascript, ActionScript and ScriptEase(2) DOM, which is an interface independent of browser, platform and language, allowing users to access other standard components of the page. DOM resolves the conflict between Netscape and Microsoft, providing a standard method for Web developers to conveniently access data, scripts and presentation layer objects in the site. (3) BOM, which can access and operate the browser window. Using BOM technology, web developers can move the window, change the status bar and perform some operations unrelated to the page content. It The characteristics are as follows: Pop up a new browser…
JavaScript, C# URL encoding and decoding summary
Javascript part encodeURI() (decoded as: decodeURI()): Unescaped characters: – _ . ! ~ * ‘ ( ) ;/?:@&=+$,# For example: encodeURI(“https://www.jb51.net?a=-_.!~*'();/?:@&=+$,#”) Output: “https://www.jb51.net?a=-_.!~*'();/?:@&=+$,#” encodeURIComponent() (decoded as: decodeURIComponent() ): Unescaped characters: – _ . ! ~ * ‘ ( ) For example: encodeURIComponent(“https://www.jb51.net?a=-_.!~*'();/?:@&=+$,#”) Output: “http%3A%2F%2Fwww.jb51.net%3Fa%3D-_.!~*'()%3B%2F%3F%3A%40%26%3D%2B%24%2C%23 ” Difference: For the processing of characters;/?:@&=+$,#. There is an additional one: escape(), but ECMAScript v3 does not support the use of this method. The reason is guessed to be related to the escape sequence. The transfer sequence of escape() is: For replaced characters with code units less than or equal to 0xFF, use a two-digit escape sequence in the form %xx. For replaced characters with code units greater than 0xFF, use a four-digit escape sequence in the form %uxxxx. Specifically, you can study the specifications of ECMAScript. Since I am too inexperienced, I will not study it in depth, haha. . unescape() is also deprecated. C# part: The C# part is quite confusing. There are not only a lot of urlencodes, but also a lot of htmlencodes. But in fact, when processing url, we only need to pay attention to the url part. The html part will be used when we process html. For example,…
A brief analysis of what Java, C/C++, JavaScript, PHP, and Python are used for development respectively?
First of all, let’s popularize the basic knowledge of programming languages. The purpose of developing programs in any programming language is to make the computer work, such as writing an article, downloading an MP3, etc. The CPU that works in the computer only understands the instructions of the machine. Therefore, although different programming languages are very different , and finally have to be “translated” into machine instructions that the CPU can execute. In theory, any language can do almost anything, but the main purpose is different. 01、Java Java is often associated with “enterprises”. Because it has some good language features and rich frameworks, it is the most popular in enterprise applications. You can always hear about things like J2EE, JSP, and Hibernate. Discussion. At the same time, Java also has a place in the field of mobile phones. Before widespread intelligence, many mobile phones used supporting Java applications as a selling point. After the outbreak of smart phones, the home of Java mobile phones became Android, as the standard programming language of Android. live. Summary: Java: web pages, enterprise-level development, general application software, game backend. 02, C and C++ Theoretically, C/C++ can be used for any development as long as…
JavaScript, jquery closure concept analysis
But I use Javascript often, so I need to understand the concepts involved. In fact, the concept of closure in Javascript is very simple, that is, the function uses external variables and can be obtained without passing parameters. For example: The code is as follows: The first function sayHello does not pass parameters and directly uses the sMessage variable. This is called closure . The second function is more complicated. There is a doAddition in it which is also a closure function. It does not require parameters and directly obtains iNum1, iNum2 and the external variable iBaseNum in the execution environment. The third function can protect the access of the i variable, and always save i in the memory, and can continue to increase. (A classic use of closures) The closure in jquery is similar, let’s give an example first You may ask Code As follows: (function($){ $(“div p”).click(function(){alert(“cssrain!”)}); })(jQuery); //a Closure What is this way of writing? Don’t worry, I also asked upc for advice, and then I understood a little bit. The $ here is just a formal parameter, but jquery is a global variable, so it will be executed automatically without calling the function, or it can…
Some HTML, JavaScript, and ASP codes worth collecting
1. CDONTS.NewMail component usage instructions Set MailObject = Server.CreateObject(“CDONTS.NewMail”) MailObject.From = “Sending Email” MailObject.To = “Receiving Email ” MailObject.Cc = “CC Email” MailObject.Bcc = “Bcc Email” MailObject.Subject = “Mail Subject” MailObject.Body = “Mail Content” MailObject.MailFormat = 0 ‘The format of the email, 0 is MIME format, 1 is text message MailObject.BodyFormat = 0 ‘The format of the body of the email, 0 means HTML format, 1 means ordinary text MailObject.Importance = 1 ‘Importance of the email, 0 means low importance, 1 means normal, 2 means high importance MailObject.AttachFile “Absolute path of attachment”, “Attachment name” MailObject.Send Set MailObject = Nothing 2. The web page will not be cached Response.Expires = -1 Response.ExpiresAbsolute = Now() – 1 Response.cachecontrol = “no-cache” 3. Client IP address Request.serverVariables(“REMOTE_ADDR) 4. Methods of the recordset object: rs.movenext Move the record pointer down one line from the current position rs.moveprevious Move the record pointer up one row from the current position rs.movefirst Move the record pointer to the first row of the data table rs.movelast Move the record pointer to the last row of the data table rs.absoluteposition=N Move the record pointer to row N of the data table rs.absolutepage=N Move the record pointer to the first row…
JavaScript, implementation of the function of moving the select tag element left and right
Design a piece of code through Javascript to achieve the following functions. The initial interface is as shown below. Select several options in the left label and then click –> to move them to the right frame and the left options disappear. After clicking ====>, all the options on the left will be moved to the right. After clicking on a few options on the right, and then clicking <—, these options will be moved to the left. Click <====, and the options will be moved to the right. All options are moved to the left. The code is as follows: one two three four five six ” Onclick=”add()”> ” Onclick=”addall()”> <input type="butoon" value=" <input type="butoon" value=" seven The results are as follows The above is the entire content of this article. I hope it will be helpful to everyone’s study and I hope you will support me a lot.
Observer pattern implementation code in ruby, javascript, php
In the interview, I was asked about the observer pattern in js. I have known about it for a long time. It can be said to be a very useful design pattern in dynamic languages. I am very ashamed that I have not studied it systematically. But it doesn’t matter. If you don’t know how to fix it, start immediately and implement it in every language you know. Observer Mode Regarding the observer mode, “Yukihiro Matsumoto’s Programming World” makes it very clear: the observer mode is that when the state of an object changes, all objects that depend on the state are automatically notified, and the observed and the observer They are a one-to-many relationship. The book also gives a very easy-to-understand example: getting the current system time and outputting it to the command line. If you want to hardcode it, it’s very simple. Define a method to get the time first and then process the display. In this way, the function of obtaining time cannot be reused, because it is a drag bottle for processing display. If you use the observer pattern, you can do this: define two classes, one for timing and getting the current time; the other…
Javascript, why is it considered octal?
I am passing the id as a parameter to the Javascript function and since it comes from the UI it is zero padded. But it seems to have (possibly) “weird” behavior? console.log(0000020948); //20948 console.log(0000022115); //9293 which is 22115’s octal console.log (parseInt(0000022115, 10)); // 9293 which is 22115’s octal console.log(0000033959); //33959 console.log(20948); //20948 console.log(22115 ); //22115 console.log(33959); //33959 How can I make sure they parse to the correct number? (decimal) EDIT: Just to make it clearer: The numbers come from the server and are zero padded strings. I am making one for each Delete button. Like: function printDelButton(value){ console.log(typeof value); //output string return ”}and function printDelButton(value){console.log(typeof value); //output numeric console.log(value); //here output as octal …. :S } I tried: console.log(parseInt(0000022115, 10)); // 9293 which is 22115’s octal Still parsed as octal Workaround: If you receive the parameter as a string object, you should be able to use it parseInt( string, 10) Interpret strings as decimal even if they start with 0. In your test, you pass the parseInt method a number , instead of a string, maybe that’s why it didn’t return the expected result. Try parseInt(‘0000022115’, 10 ) replace parseInt(0000022115, 10) This does return 221115 for me.
The php button disappears after clicking, javascript,_After clicking the button to add a label, the added label flashes and disappears? , javascriptphpStudy…
After clicking the button to add a label,The added label flashes and disappears? Clicking the button to add a label is as follows: But after clicking add The label flashed and then disappeared (the gif could not be recorded, but it was indeed added and is there any more) ,At the same time, there was a question mark after the URL,You can click the back button…. Why is this ?What does it have to do with? demo link html Confirm interests Javascript var $ = function(x){ return document.querySelector(x); }; var $a = function(id){ return document.getElementById(id); }; function addEvent(element ,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false); }else if (element .attachEvent) { element.attachEvent('on'+type,handler); }else{ element ['on'+type] = handler; } } var arrHobby=[ ]; function displayHobby(){ var hobby = $('textarea').value.trim(); arrHobby.push(hobby); renderHobby(); } function clickKeyup(){ addEvent($ ('button'),'click',displayHobby); } function renderHobby(){ var hobbyList=''; for(var item in arrHobby){ hobbyList += '' + arrHobby[item] +''; } $a('hobby_list').innerHTML = hobbyList; } function init(){ clickKeyup( ); renderHobby(); } init(); Related reading: How to Convert IPV6 to IPv4; Is there a plug-in with a tree structure similar to ztree How to not be affected by the root directory when the html page jumps? #xff1f; Javascript scope problem @Invalid use of font-face AppID setting…