andreathedove Posted February 22, 2008 Share Posted February 22, 2008 Hello,I have error with this code: <p align="center"><% // CREO IL DOM set xmlbanner = Server.CreateObject("Microsoft.XMLDOM") // CARICO IL FILE XML xmlbanner.async = false xmlbanner.load(Server.MapPath("../mdb-database/xml/adv.xml")) // RECUPERO I NODI CHE MI INTERESSANO banner = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/circuito1") dcircuito1 = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/dcircuito1") ID = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/ID") att1 = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/attivo1") // GENERO UN NUMERO CASUALE IN FUNZIONE DEL NUMERO DI NODI PRESENTE NEL FILE XML casuale = Math.floor(Math.random() * banner.length) // STAMPO A VIDEO IL BANNER BANNER_ = banner(casuale).textdcircuito1_ = dcircuito1(casuale).text%></p> The erroe is:http://www.allinonenet.it/prezzi_pazzi/adv2.aspThanks,Andrea Link to comment Share on other sites More sharing options...
Reg Edit Posted February 23, 2008 Share Posted February 23, 2008 casuale = Math.floor(Math.random() * banner.length)It's a long time since I did any classic ASP, but... The above line of code allows casuale to be greater than dcircuito1.length. So depending on the data this could result in a null object reference here:dcircuito1_ = dcircuito1(casuale).text Also I think for object assignments in vbscript you need to use set? In which case you would need to change this: banner = xmlbanner.getElementsByTagName.... to: set banner = xmlbanner.getElementsByTagName.... and the same for the other similar lines. Link to comment Share on other sites More sharing options...
andreathedove Posted February 23, 2008 Author Share Posted February 23, 2008 It's a long time since I did any classic ASP, but... The above line of code allows casuale to be greater than dcircuito1.length. So depending on the data this could result in a null object reference here:dcircuito1_ = dcircuito1(casuale).text Also I think for object assignments in vbscript you need to use set? In which case you would need to change this: banner = xmlbanner.getElementsByTagName.... to: set banner = xmlbanner.getElementsByTagName.... and the same for the other similar lines. thank you very much,andrea Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.