검색결과 리스트
JS에 해당되는 글 43건
- 2014.04.06 webrtc
- 2014.04.06 webRTC
- 2014.04.06 document.querySelector
글
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <title>webRTC test</title> <!-- <script src="webrtc_test.js"> </script> --> <script src="adapter.js"> </script> </head> <body style="background: gray;"> <video autoplay id="fuckingvideo"> </video> <div> </div> <script> var errorCallback = function(e) { console.log('Reeeejected!', e); }; // Not showing vendor prefixes. navigator.getUserMedia({video: true, audio: true}, function(localMediaStream) { var video = document.getElementById("fuckingvideo"); //혹은 querySelector('video'); //video.src = window.URL.createObjectURL(localMediaStream); video.setAttribute("src",window.URL.createObjectURL(localMediaStream)); // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. // See crbug.com/110938. video.onloadedmetadata = function(e) { // Ready to go. Do some stuff. }; }, errorCallback); var temp = document.querySelector('div'); //Returns the first element within the document (using depth-first pre-order //traversal of the document's nodes) that matches the specified group of selectors. temp.innerHTML = "FUCK"; </script> </body> </html> |
글
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <title>webRTC test</title> <!-- <script src="webrtc_test.js"> </script> --> <script src="adapter.js"> </script> </head> <body style="background: gray;"> <video autoplay id="fuckingvideo"> </video> <div> </div> <script> var errorCallback = function(e) { console.log('Reeeejected!', e); }; // Not showing vendor prefixes. navigator.getUserMedia({video: true, audio: true}, function(localMediaStream) { var video = document.getElementById("fuckingvideo"); //혹은 querySelector('video'); //video.src = window.URL.createObjectURL(localMediaStream); video.setAttribute("src",window.URL.createObjectURL(localMediaStream)); // Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia. // See crbug.com/110938. video.onloadedmetadata = function(e) { // Ready to go. Do some stuff. }; }, errorCallback); var temp = document.querySelector('div'); //Returns the first element within the document (using depth-first pre-order //traversal of the document's nodes) that matches the specified group of selectors. temp.innerHTML = "FUCK"; </script> </body> </html> |
글
document.querySelector
JS
2014. 4. 6. 00:51
Summary
Returns the first element within the document (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors.
Syntax
element = document.querySelector(selectors);
where
element
is an element object.selectors
is a string containing one or more CSS selectors separated by commas.
Example
In this example, the first element in the document with the class "myclass
" is returned:
var el = document.querySelector(".myclass");
출처: https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector