| |

VerySource

 Forgot password?
 Register
Search
View: 1500|Reply: 3

How to judge whether an object is valid?

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-11 18:30:01
| Show all posts |Read mode
var obj = frame.document.form.text1;
The frame in the above statement is an iframe. When I refresh this iframe, I check obj != false, but obj does not point to the refreshed frame.document.form.text1. How to detect this status?
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2021-3-11 19:15:01
| Show all posts
Use if(obj == frame.document.form.text1)
Reply

Use magic Report

0

Threads

17

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2021-3-11 19:30:01
| Show all posts
I feel I should use ===
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2021-3-11 20:15:01
| Show all posts
Is obj==null returns fasle not obj != fasle
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