.split() not working as expected in IE8

后端 未结 5 794
Happy的楠姐
Happy的楠姐 2021-01-13 03:48

I\'m using the following to extract variables from a URL contained in a variable. It works fine in modern browsers but in IE8 it fails on the first variable but succeeds on

5条回答
  •  無奈伤痛
    2021-01-13 04:41

    You can find both dimensions with a match or exec expression:

    var p = 'http://sagensundesign.com?height=400&width=300';
    
    var siz=p.match(/((height|width)=)(\d+)/g);
    
    
    alert(siz)
    
    /*  returned value: (Array)
    height=400, width=300
    */
    

提交回复
热议问题