반응형

오디오 태그는 웹브라우저에서 플러그인의 도움 없이 음악을 재생할 수 있게 만들어주는 HTML5 태그 이다.

HTML5에서 추가된 기능이므로 IE8 이하에서는 사용할 수 없다.


audio 태그의 속성

<audio src="Kalimba.mp3" controls="" autoplay="" loop="" preload="auto"></audio>


속성 이름

값 

설명 

src

URL 

음악파일의 경로지정 

controls

"controls", "" , -  

음악 재생 도구를 출력할지 지정 

autoplay 

"autoplay", "", - 

음악을 자동 재생할지 지정 

loop 

"loop", "", - 

음악을 반복할지 지정 

preload

"none", "metadata", "auto" 

음악을 재생하기 전에 모두 불러올지 지정

none : 사용자가 오디오를 필요로하지 않을 것이라고 명시, 미리 다운로드 하지 않음

metadata : 사용자가 오디오를 필요로 하지 않을 것이지만, 기본정보(크기,첫프레임,오디오길이 등)는 가져온다.

auto : 사용자가 비디오를 필요로 하고 미리 다운로드를 한다 (기본값)

 


※브라우저마다 지원하는 오디오 확장자 형식이 다르기 때문에 모든 브라우저에서 오디오태그가 실행 되기 위해서 source 태그를 사용한다.


 

<audio controls="controls">

    <source src="Kalimba.mp3" type="audio/mp3" />

    <source src="Kalimba.ogg" type="audio/ogg" />

</audio>


 *웹브라우저에서 지원하는 음악파일 형식

 

 IE

크롬 

파이어폭스 

사파리 

오페라 

MP3

O 

O 

X 

O 

X 

OGG 

X 

O 

O 

O 

O 

WAV 

X 

O 

O 

X 

 


source 태그의 type 속성을 입력하지 않아도 상관없다. 

하지만 type 속성을 입력하지 않으면 웹브라우저가 음악 파일을 내려받은 뒤에 재생 가능한 파일인지 확인하므로 트래픽이 낭비된다. 

따라서 type 속성을 꼭 지정해준다.

반응형
반응형
var mobilecheck = function() {
 var check = false;
 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
 return check;
}

 

반응형
반응형

(function() {
    var link = document.createElement('link');
    link.type = 'image/x-icon';
    link.rel = 'shortcut icon';
    link.href = '/resources/pubtree/images/favicon.ico';
    document.getElementsByTagName('head')[0].appendChild(link);
}());

반응형
반응형

1.<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="inputTypeText" style="width:170px;border:1px solid #7f9db9;"

2.onkeydown="javascript: if (event.keyCode == 13) {chkform();}"/>


onkeydown="javascript: if (event.keyCode == 13) {chkform();}" 이런식으로 체크한다.

함수 호출로 chkform();

01.function chkform()
02.{
03.var f = document.fo_search;
04.if(f.addr1.value == '')
05.{
06. alert('지역을 선택해주세요.');
07. f.addr1.focus();
08. return false;
09.}else{
10. document.fo_search.submit();
11.}
12.}


 

 

document.fo_search.submit();
이런식으로 form의 submit 실행

반응형
반응형

CSS3 gives us the ability to create rounded corners with the border-radius property. But as you might already know, this new feature is not recognized in Internet Explorer 8 (IE8) and its earlier versions. So when you apply CSS3 Border Radius to an element, it still appears as a box with pointed tips.

 

 

You may find a lot of different advice on the Internet suggesting you ignore IE8. You wish you could do so. But if you’re working on a website for a government institution or a bank, you may not have a choice. You still have to make the website look as nice as it does in modern browsers, which includes the ability to apply CSS3 Border Radius.

If you really have to make your website IE8-ready, while being able to use the CSS3 feature, we have just the tip for you.

CSS3Pie

CSS3Pie is a kind of polyfill for CSS3 decorative features. Aside from CSS3 Border Radius that we’re going to discuss in this article, CSS3Pie also supports Box Shadow and Gradients, though it’s limited to the Linear Gradient type.

Download CSS3Pie (here). Put it inside your project directory – I placed it in the css folder. As you can also see from the screenshot below, I’ve created one stylesheet as well as one HTML file.

 

 

Open the stylesheet in code editor and set one of the elements in the HTML file with rounded corners, like so:

1
2
3
4
5
6
7
8
.border-radius {
    height: 100px;
    width: 100px;
    background-color: #2ecc71;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
}

As the element’s width and height are both 100px, and the border-radius is set to 50px, the element will become a circle:

 

 

In IE8, as we expect, it would still be a square (sigh), but don’t worry.

 

 

To enable the rounded corner effect, insert this line: behavior: url(css/pie.htc);, like so.

1
2
3
4
5
6
7
8
9
.border-radius {
    height: 100px;
    width: 100px;
    background-color: #2ecc71;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
    behavior: url(css/pie.htc);
}

Note that the file path in url()has to be either an absolute path or relative to the HTML file. You can also add this line in a separate file.

You may have a stylesheet that is designated for Internet Explorer. You can put behavior: url(css/pie.htc); within that file, but ensure that it’s declared within the same CSS selector, like so.

1
2
3
4
/* declared in ie.css */
.border-radius {
    behavior: url(css/pie.htc);
}

Refresh the page in IE8. The rounded corner should now come into effect (ta-da!). It should work in IE7 as well.

 

 

Troubleshooting

Internet Explorer may behave unexpectedly. If this does not work (maybe the rounded corner does not take effect, or the selected element has disappeared), adding the position and zoom property should solve the problem:

1
2
3
4
5
6
7
<style>
.border-radius {
    behavior: url(<?php echo get_template_directory_uri() ;?>/css/pie.htc);
    position: relative;
    zoom: 1;
}
</style>

Using CSS3 Pie in WordPress

You have finished putting your website in HTML form. You also utilize pie.htc in the website to enable CSS3 in IE8. At this stage, you are ready to transform the website into a functioning WordPress theme. In this case, as WordPress is dynamic, where pages may serve in different level URLs, we have to specify an absolute path.

You can either change the path in CSS like this:

1
2
3
4
5
.border-radius {
    behavior: url(http://localhost/{website}/wp-content/themes/{the_theme}/css/pie.htc);
    position: relative;
    zoom: 1;
}

Or add internal styles in the header.php, this way:

1
2
3
4
5
6
7
<style>
.border-radius {
    behavior: url(<?php echo get_template_directory_uri() ;?>/css/pie.htc);
    position: relative;
    zoom: 1;
}
</style>

Final Thought

Having cool things such as CSS3 Border Radius work in IE8 is fascinating, and CSS3Pie makes that happen, while giving us one less reason to hate IE8.

반응형

'웹프로그래밍 > CSS' 카테고리의 다른 글

Background-size for IE7,8  (0) 2015.04.24
CSS3 구조선택자  (0) 2015.04.24
CSS 동위선택자, 상태선택자  (0) 2015.04.24
CSS 속성선택자  (0) 2015.04.24
텍스트 줄바꿈 처리 word-break, white-space  (0) 2015.04.09
반응형

Conditional comments with IE

Since Internet Explorer 5, conditional comments have been used to show or hide extra content from Internet Explorer.

The syntax

The example below will add a CSS style sheet only if the browser viewing the page is IE6:

<!--[if IE 6]>
    <link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->

Any HTML that appears between the IF statement will be added to the document if viewed using the specified version of Internet Explorer.

You can use the following names to identify versions of Internet Explorer:

Name Description
IE All versions of Internet Explorer less than version 10
IE 5, IE 6, IE 7, IE 8, IE 9 Only the version mentioned

You can also use the following modifiers:

Name Description
lt All versions less than
lte All versions less than or equal to
gt All versions greater than
gte All versions greater than or equal to

Expressions can be combined as follows:

Name Example Description
Not !(IE 6) Not Internet Explorer 6
And (gt IE 6)&(lt IE 9) Greater than Internet Explorer 6 and less than Internet Explorer 9
Or (IE 7)|(IE 8) Internet Explorer 7 or Internet Explorer 8

The following example will add some JavaScript to all versions of Internet Explorer less than version 8:

<!--[if lte IE 8]>
    <script type="text/javascript" src="ie.js"></script>  
<![endif]-->

Exclude Internet Explorer

As well as including code for Internet Explorer, you can also hide code from Internet Explorer:

<!--[if !IE]><!-->
    <div>You are not using Internet Explorer (less than version 10)</div>
<!--<![endif]-->
Notice the syntax difference when excluding Internet Explorer
Internet Explorer 10 does not support conditional tags, and behaves like other non-IE browsers

If-else statements

You can combine the comments to make if-else style statements:

<!--[if IE]>
    <div>You are using Internet Explorer (less than version 10)</div>
<![endif]-->
<!--[if !IE]><!-->
    <div>You are not using Internet Explorer, or using IE version 10</div>
<!--<![endif]-->

 

반응형

'웹프로그래밍' 카테고리의 다른 글

Huzy TOOLS 를 시작.  (0) 2024.01.02
한 도메인으로 접속하게 하기 (www 자동 붙이기)  (0) 2016.05.25
MySQL 수정  (0) 2014.06.28
웹폰트 완벽 사용법? (woff, eot)  (0) 2014.03.08
XE 템플릿 구문  (0) 2014.02.18
반응형

php에서는 copy함수를 이용하여 간단하게 파일을 복사하거나 unlink(또는 delete)함수로 파일을 삭제할 수 있습니다. 이 두 함수는 복사, 삭제에 성공할 경우 true를, 실패하면 오류 코드 메시지를 표시하므로 함수 앞에 @를 붙여 보안 유효성을 높여 주도록 합니다.

bool copy ( string $source , string $dest [, resource $context ] ) (PHP 4, PHP 5)

 copy(원본 파일명, 복사 파일명);
 unlink(삭제 파일명);

대상 파일이 이미 존재하면 덮어 쓰는 점에 주의가 필요합니다. 다음은 파일 복사 예제입니다.

예제 (ex #1

 <?php
 
// test.php파일을 복사본 test.php.bak로 만듭니다.
 
$oldfile 'test.php'
// 원본파일
 
$newfile 'test.php.bak'
// 복사파일

 // 실제 존재하는 파일인지 체크...
 
if(file_exists($oldfile
)) {
      if(!
copy($oldfile$newfile
)) {
            echo 
"파일 복사 실패"
;
      } else if(
file_exists($newfile
)) {
            echo 
"파일 복사 성공"
;
      }
 }
 
?>


다음은 파일 이동 예제입니다.

예제 (ex #2

 <?php
 
// test.php파일을 test.txt로 만듭니다.
 
$oldfile 'test.php'
// 원본파일
 
$newfile 'test.txt'
// 복사파일

 // 실제 존재하는 파일인지 체크...
 
if(file_exists($oldfile
)) {
      if(!
copy($oldfile$newfile
)) {
            echo 
"파일 복사에 실패하였습니다."
;
      } else if(
file_exists($newfile
)) {
            
// 복사에 성공하면 원본 파일을 삭제합니다.
            
if(!@unlink($oldfile
)){
                 if(@
unlink($newfile
)){
                      echo 
"파일이동에 실패하였습니다."
;
                 }
            }
      }
 }
 
?>


단순히 파일이름만 변경 원할 경우 rename함수를 이용하면 됩니다. 이 함수는 파일(또는 폴더)의 이름을 변경합니다. 성공하면 true를, 실패하면 false를 반환합니다.

bool
rename ( string $oldname , string $newname [, resource $context ] ) (PHP 4, PHP 5)

예제 (ex #3

 <?php
 
// dir1 폴더를 dir2폴더로 이름을 변경합니다.
 
if(rename("dir1","dir2"
)){
     echo 
"이름 변경 성공"
;
 }

 
// file1.php을 file2.php로 이름을 변경합니다.
 
if(rename("file1.php","file2.php"
)){
     echo 
"이름 변경 성공"
;
 }
 
?>


단순히 copy, unlink함수를 이용하지 않고, fopen함수로 표현이 가능합니다. 다음이 그 좋은 예입니다.

예제 (ex #4

 <?php
 
// test.php파일을 복사본 test.php.bak로 만듭니다.
 
$oldfile 'test.php'
// 원본파일
 
$newfile 'test.php.bak'
// 복사파일

 
if(file_exists($oldfile
)) {
      
$data file_get_contents($oldfile
);
      
$fp fopen($newfile'w+'
);
      if(
is_resource($fp
)){
            
fputs($fp$data
);
      }
      
fclose($fp
);
 }
 
?>


예제 (ex #5

 <?php
 
// test.php파일을 복사본 test.php.bak로 만듭니다.
 
$oldfile 'test.php'
// 원본파일
 
$newfile 'test.php.bak'
// 복사파일

 
if(file_exists($oldfile
)) {
     
$fold fopen($oldfile,'r'
); 
     if(
is_resource($fold
)){
            
$fnew fopen($newfile,'w+'
); 
            
$len stream_copy_to_stream($fold,$fnew
); 
            
fclose($fold
); 
            
fclose($fnew
); 
     }
 }
 
?>

 

 

출처 : http://blog.habonyphp.com/62#.VS3Qm2ccS70

 

반응형

'웹프로그래밍 > PHP' 카테고리의 다른 글

PHP에서 csv로 저장시 연락처 0 삭제 방지  (0) 2015.10.23
정규식 정리  (0) 2015.06.14
PHP + jQuery AJAX Upload  (0) 2015.04.10
PHP XML CDATA Parsing  (0) 2015.04.10
PHP DOMDocument getting Attribute of Tag  (0) 2015.04.10
반응형

1. input file tag on event

 

$('#tmp_widget_file').on('change', prepareUpload);
  function prepareUpload(event){files = event.target.files}
  $('#twf').on('submit', uploadFiles);

 

2. uploadFiles function

 

function uploadFiles(event){
 event.stopPropagation();
 event.preventDefault();

 var data = new FormData();
 $.each(files, function(key, value){
  data.append(key, value);
 });

 $.ajax({
  url: './page/getWidgetInfo.php?files',
  type: 'POST',
  data: data,
  cache: false,
  dataType: 'json',
  processData: false,
  contentType: false,
  success: function(data, textStatus, jqXHR){
   if(typeof data.error === 'undefined'){
    console.log(data);
   }else{
    console.log('ERRORS1: ' + data.error);
   }
  },
  error: function(jqXHR, textStatus, errorThrown){
   console.log('ERRORS2: ' + textStatus);
  }
 });
}

 

3. upload exe php

 

$data = array();
if(isset($_GET['files'])){
 $error = false;
 $filevar = "";
 $error_msg = "There was an error uploading your files";

 $uploaddir = '/home/namo/public_html/tmp/';
 foreach($_FILES as $file){
  if(move_uploaded_file($file['tmp_name'], $uploaddir.basename($file['name']))){
   $filevar = $file['name'];
  }else{
   $error = true;
  }
 }
 $data = ($error) ? array('error' => $error_msg) : array('files' => $filevar);

}

반응형

'웹프로그래밍 > PHP' 카테고리의 다른 글

정규식 정리  (0) 2015.06.14
[php] 파일 이동, 복사 함수  (0) 2015.04.15
PHP XML CDATA Parsing  (0) 2015.04.10
PHP DOMDocument getting Attribute of Tag  (0) 2015.04.10
임시로 PHP오류 출력할 때  (0) 2015.04.10

+ Recent posts