javascript - How to find out if value is undefined or not -


I have this JavaScript in classic ASP page ...

I have to find out that x The name is undefined or value:

  x = document.getElementsByTagName ("meta") [i]; If (string (x.name)! = "Undefined" & string (x.name)! = "") {Document.write ("+ + x.name +": "+ x.content +" & lt ; Br & gt; & lt; br & gt; "};}  

I'm not sure why it is throwing an error:

  Document.write ("+ + x.name +": "+ x. Content +" 

if x The .name or x content is false?

Thanks

To undefined:

  if (typef x! == 'undefined') {if (x.name) {document.write (x.name) + ':' + X.content + '& lt; Br>  

Now, I do not know that you document.write () what are you trying to do, so that problems can happen, but the above will ensure that you do only when "x" exists and a blank in it "Name" is the attribute.


Comments