| |

VerySource

 Forgot password?
 Register
Search
View: 692|Reply: 4

The code does not have the expected effect.

[Copy link]

3

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-31 18:00:02
| Show all posts |Read mode
<body>
<form method = "post" action = "" name = "form1">
   <input type = "radio" name = "ddfind" checked = "checked" id = "radio1" onclick = "check ()" />&nbsp;&nbsp;&nbsp;
   <input type = "radio" name = "ddfind" id = "radio2" onclick = "check ()" />
</ form>
<div id = "Layer1" style = "display: block; background: # 00FFFF"> Layer 1 </ div>
<div id = "Layer2" style = "display: none; background: #CCCCCC"> Layer 2 </ div>
<script language = "javascript">
function check () {
  var find = document.form1;
  if (find.radio1.checked == true) {
    Layer1.style.display = "block";
  }
  else if (find.radio2.checked == true) {
    Layer2.style.dispale = "block";
  }
}
</ script>
</ body>


Different radio buttons appear in different points. That prawn knows to help
Reply

Use magic Report

0

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-3-11 09:00:01
| Show all posts
if (find.radio1.checked == true) {
    Layer1.style.display = "block";
Layer2.style.display = "none";
  }
  else if (find.radio2.checked == true) {
    Layer1.style.display = "none";
    Layer2.style.display = "block";
  }
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-17 14:45:01
| Show all posts
The answer upstairs should be the correct solution
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-19 13:15:01
| Show all posts
onclick = "Layer1.style.display = 'block'; Layer2.style.display = 'none';"
onclick = "Layer1.style.display = 'none'; Layer2.style.display = 'block';"
Reply

Use magic Report

3

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-6 12:30:01
| Show all posts
Thank you all, the problem is solved
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list