Souligner texte javascript

Résolu/Fermé
Mary - 9 juil. 2009 à 10:31
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 - 9 juil. 2009 à 11:45
Bonjour,

Je suis en train de travailler sur une zone de recherche. Le plus simple est que vous preniez mon code ...


<html>
<head>

<style type="text/css">
#round {
	width:800px;
	background-color: #f5f5f5;
	margin-left: auto;
	margin-right: auto;
	height: 80px;
	border-bottom: solid 1px #bbbbbb;
	border-top: solid 1px #bbbbbb;
	margin-top: 2px;
	margin-bottom: 2px;
}
</style>
</head>

<body>
<script type="text/javascript">
<!--
	function choose1(){
	document.getElementById("1").style.color="black";
	document.getElementById("2").style.color="#ca5242";
	document.getElementById("3").style.color="#ca5242";
	}
	function choose2(){
	document.getElementById("1").style.color="#ca5242";
	document.getElementById("2").style.color="black";
	document.getElementById("3").style.color="#ca5242";
	}
	function choose3(){
	document.getElementById("1").style.color="#ca5242";
	document.getElementById("2").style.color="#ca5242";
	document.getElementById("3").style.color="black";
	}
//-->
</script>


<div id="round">
		
		<!-- Partie concernee -->
		
		<span id="1" style="font-size: 14px; color: red; margin-left: 50px; color: #ca5242;" onClick="choose1()"><b>Search this site</b></span>
		<span id="2" style="font-size: 14px; color: red; margin-left: 25px; color: #ca5242;" onClick="choose2()"><b><u>Wiki Search</form></u></b></span>
		<span id="3" style="font-size: 14px; color: red; margin-left: 25px; color: #ca5242;" onClick="choose3()"><b><u>Search all history sites</form></u></b></span><br /><br />

		<!-- Fin de la partie concernee -->
		
<form action="http://boek.nuwegeskiedenis.co.za/Special:Search" name="form1">
	<table><tr>
	<td>
	<span class="Apple-style-span" style="margin-left: 5px; border-collapse: separate; font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; vertical-align: center;">
		<span class="Apple-style-span" style="color: #e4e4e4; font-family: Verdana; font-size: 12px; line-height: 18px; text-align: left;">
			<span style="margin-left: 15px; padding: 5px 13px 5px 8px; font-size: 12px; font-style: inherit; font-weight: inherit; text-decoration: inherit; background-image: url(http://z.about.com/h/hp/srch_bg.gif); background-repeat: no-repeat; display: block; float: left; background-position: 0% 100%;">
				<input name="search" type="text" style="border: 2px solid rgb(205, 205, 205); margin: 0px; padding: 0px 0px 0px 0px; vertical-align: middle; width: 300px; font-family: Verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 1.2; font-size-adjust: none; font-stretch: normal; height: 20px;" >
				<input type="submit"  value="FIND" style="margin-left: 5px;border-width: 0px; padding: 0px; cursor: pointer; vertical-align: middle; background-color: #c31b01; height: 25px; text-align: center; text-indent: -9999px; width: 63px; margin-bottom: 3px; background-position: 50%; color: #ffffff;" /></td>
			</span>
		</span>
		<td>
		<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
			<span style="color: rgb(51, 51, 51); font-family: Verdana; font-size: 12px; line-height: 18px; text-align: center;"></span>
				<label name="searchtext" type="text" style="font-size: 10px; font-family: 'Verdana'; margin-left: 5px; color: #999999;">> Search the History site for information by typing a keyword</label>
			</span>
		</span>
		</td></tr></table>
	</span>
</form>
</div>

</body>
<html>


Il y a beaucoup de lignes en tout mais la zone "interessante" est petite. Donc vala, en haut, il faut selectionner l'un des textes en rouge. Lorsque l'on clique dessus, il doit s'afficher en noir non souligne et les deux autres en rouge souligne. J'ai assez vite trouve comment changer de couleur mais pour les soulignements je seche un peu ... Est-ce que quelqu'un a une idee ? :/

Merci d'avance ^^
A voir également:

13 réponses

resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 11:45
heu c'est dans mon dernier message ca ....

5
resalut, le jeudi 9 juillet 2009 à 10:48:17

*
*
*
*
*

Document.getElementById('1').style.textDecoration = 'underline';
2
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 10:34
document.getElementById("1").style.text-decoration="underline"; non ?
1
Il suffisait d'enlever le tiret ^^

document.getElementById("1").style.textDecoration = "underline";

Merci ;)
1
J'ai essaye, quand je mets ca plus rien ne fonctionne ... ^^"
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 10:42
normal je n'etait pas sur :p
document.getElementById('1').style.text-decoration = 'underline';
0
Non il n'aime vraiment pas ^^
0
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 10:48
document.getElementById('1').style.textDecoration = 'underline';
0
Non mais je ne veux pas etre desagreable hein mais ca ne marche pas ton truc, donc on pourrait peut-etre passer a autre chose ? ...
0
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 10:52
jveu pas etre mechant mais ta tester le dernier ?
0
Oui je l'ai teste et non ca ne marche pas ...
0
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 10:59
alors je ne peux rien faire pour toi car c'est bien comme cela qu'il faut faire je viens de faire des recherches
0
Est-ce que tu peux me donner les liens ?
0
resalut Messages postés 784 Date d'inscription vendredi 26 juin 2009 Statut Membre Dernière intervention 21 janvier 2010 55
9 juil. 2009 à 11:10
http://fr.selfhtml.org/javascript/objets/style.htm
0