让说我们是天花板高度URL字符串:由字符串分割,并检查零件,以防止错误
http:/domain.com/en/#{html file}/{id of the div}-{level}
这样我可以知道:
http:/domain.com/en/#the-file.html/section-4
在那里我有成文
var info = window.location.hash;
var temp = info.split("/");
var url = temp[0];
url = str_replace('#','',url);
var temp1 = temp[1];
temp1 = temp1.split('-');
var seccion = temp1[0];
var nivel = temp1[1];
其中
console.log('url: '+url);
console.log('info: '+nivel);
console.log('seccion: '+seccion);
我提供这些编纂瓦尔
问题时,例如,URL是
http://domain.com/es/
是萤火虫跳这个错误:
temp1 is undefined
任何想法如何预防?
嘿!谢谢!工作和看起来更好:) – 2011-12-28 13:01:27