40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| //while (confirm("pute ?")) {
 | |
| 	/*alert('Hello world!');
 | |
| 	if (confirm("sûre ?"))
 | |
| 		parseInt(prompt("Entrez l'étage où l'ascenseur doit se rendre (de -2 à 30) :"));
 | |
| 	else {
 | |
| 		alert("Tamr");
 | |
| 	}
 | |
| }*/
 | |
| 
 | |
| var image = document.getElementsById('link_line');
 | |
| console.log(image);
 | |
| var child = image.lastChild;
 | |
| while (child) {
 | |
|         if (child.nodeType === Node.ELEMENT_NODE) { // C'est un élément HTML
 | |
|             //alert(child.firstChild.data);
 | |
|         } else { // C'est certainement un nœud textuel
 | |
|             //alert(child.data)
 | |
|         }
 | |
| 
 | |
|         child = child.previousSibling; // À chaque tour de boucle, on prend l'enfant précédent
 | |
| 
 | |
| }
 | |
| 
 | |
| //var image = document.getElementsById('image');
 | |
| 
 | |
| var divs = document.getElementsByTagName('div');
 | |
| 
 | |
| for (var i = 0; i < 3; i++) {
 | |
| 	var newElement = divs[i].appendChild(document.createElement('a'));
 | |
| 	url = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
 | |
| 	console.log(url);
 | |
| 	for (var j = 0; j < url.length; j++) {
 | |
| 		url[j] = url[j] % 26 + 'a'
 | |
| 	}
 | |
| 	newElement.title = 'tanche'
 | |
| 	newElement.href = 'http://' + url + '.com'
 | |
| 	newElement.appendChild(document.createTextNode("pte"));
 | |
| }
 | |
| console.log("fin");
 |