Jump to content

Kowa92

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by Kowa92

  1. Okay, thanks for your suggestion... But, how can i close a (main) window that i haven't open with the "open()" command?
  2. Hi All! I've a problem with this code that doesn't work... And i don't understend where is the mistake... This is the code: <a href="javascript:window.close();" >Close Main Window</a> Why this doesn't work? I've the Chrome Browser... But i tryed with Mozzilla Firefox too, but however doesn't want to work... Why?
  3. Pls, can you make me a little and fast example about what do you mean? This is a good solution... However, how would you do for solve it? With a little and fast example, perhaps...
  4. No, unfortunately it doesn't work...
  5. Outside of the head tags, precisely between body tags... Like this:CODE: <html><head> <style type="text/css"> body { background-color:#d0e4fe; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } </style> <script type="text/javascript"> function mymsg() { window.alert("Benvenuto nel Tryit Editor! =D"); } </script></head><body> <h1>Tryit Editor</h1> <p>Scrivi il codice e guarda il risultato con un click! =D</p> <form> <input type="button" value="Click Me!" onClick="mymsg();" /> </form> <script type="text/javascript"> void(); </script></body></html>
  6. Ok now it works correctly. Thank you!But the way, and if i want to target only the second script block, how should i modify the match pattern string?
  7. Ok thank you. But i have another question: If I put a source text like this: <html><head> <style type="text/css"> body { background-color:#d0e4fe; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } </style> <script type="text/javascript"> function mymsg() { window.alert("Benvenuto nel Tryit Editor! =D"); } </script></head><body> <h1>Tryit Editor</h1> <p>Scrivi il codice e guarda il risultato con un click! =D</p> <form> <input type="button" value="Click Me!" onClick="mymsg();" /> </form> <script type="text/javascript"> void(); </script> </body></html> and write a match pattern like this: /<script type="text\/javascript">([\w\W]*)<\/script>/ with replace patterns like these: '' how do I select only one of two matches (ie replacing only the content and its script tag content between the head tags) instead of doing as he does here? : and why the preg_replace () behaves like this? selected script tags of preg_replace() are bold. CODE: <html><head> <style type="text/css"> body { background-color:#d0e4fe; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } </style> <script type="text/javascript"> function mymsg() { window.alert("Benvenuto nel Tryit Editor! =D"); } </script></head><body> <h1>Tryit Editor</h1> <p>Scrivi il codice e guarda il risultato con un click! =D</p> <form> <input type="button" value="Click Me!" onClick="mymsg();" /> </form> <script type="text/javascript"> void(); </script></body></html>
  8. Thank you very much! Now it works correctly! But the way, for characters class do you mean these: "\s, \w, \W"?
  9. Doesn't work... Other solutions?
  10. Hi All! I would delete the heads tags's contents of a string from a request like this: $head = "/<head>(\s.*)*<\/head>/"; $mycode = preg_replace( $head, '', $_REQUEST['mytext']); print($mycode); The string of the request can be simplified as follows: $mytext = '<html><head> <style type="text/css"> body { background-color:#d0e4fe; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } </style> <script type="text/javascript"> function mymsg() { window.alert("Benvenuto nel Tryit Editor! =D"); } </script></head><body> <h1>Tryit Editor</h1> <p>Scrivi il codice e guarda il risultato con un click! =D</p> <form> <input type="button" value="Click Me!" onClick="mymsg();" /> </form> </body></html>' But my RegExp not work because the result of the function "preg_replace" returns a PHP error (null). So I tried to write other RegExp to try to clear the contents of the other basic tags: $html = "/<html>(\s.*)*<\/html>/";; $body = "/<body>(\s.*)*<\/body>/"; Inserting them in the first feature I noticed that they both work correctly. This is my problem: Why the first RegExp (head) is not working properly but the other two work? Thanks.
×
×
  • Create New...