Toon posts:

[JS] hide option met 1 button

Pagina: 1
Acties:

Verwijderd

Topicstarter
Wat doe ik hier nou fout?
Ik heb vanalles geprobeerd dus zal waarschijnlijk wel wat kleins zijn...ben ook een beetje n00b
tnx

code:
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
<html>
<title>Zoeken</title>
<script language="JavaScript">


function attach(id)
{
 var obj
 obj = document.getElementById(id);
return obj
}

function show_obj(id)
{
 temp_Obj = attach(id);
 if(temp_Obj.style.visibility == "hidden"){
  then temp_Obj.style.visibility = "visible"};
    else  {temp_Obj.style.visibility = "hidden"}
}

</script>
<body>


<input name="Zoekveld" type="text" size="70">
<input type=button value = "Zoek" onClick = "window.location.href='2.1.asp';">
<input type=button onclick="show_obj('myObject')"  value = "Geavanceerd"><p>
<div id="myObject" style="visibility:hidden">(ajaman)</div><br>
</body>
</html>

  • Thijsmans
  • Registratie: Juli 2001
  • Laatst online: 21:20

Thijsmans

⭐⭐⭐⭐⭐ (5/5)

Kijk eens naar de volgorde van } en ; :)

code:
1
2
3
4
5
6
7
8
9
function show_obj(id)
{
 temp_Obj = attach(id);
 if(temp_Obj.style.visibility == "hidden"){
   temp_Obj.style.visibility = "visible";
 } else {
   temp_Obj.style.visibility = "hidden";
 }
}

Privacy-adepten vinden op AVGtekst.nl de Nederlandse AVG-tekst voorzien van uitspraken en besluiten.


Verwijderd

Topicstarter
tnx you did it :D
/me is in deep shame