[]读URL parameter

https://www.hello.com?index=helloJane
 
读URL parameter

例如:
https://www.hello.com?index=helloJane

把“helloJane”放进页面的text 请问这个怎么做呢?
 
好像这样, 这个window.location.href 在LayaAirIDE 怎么写呢?
var url = window.location.href;
var index = null;
if(url.lastIndexOf('?') != -1) {
    index = url.split('?')[1];
    index= index.split('=')[1];
}
已邀请:

Aar0n

赞同来自:

语法问题,建议去语法相关的网页查询一下。

sheen

赞同来自:

先把地址截取到?然后从?之后截取的字符串.split("="),返回的数组0是index 1是helloJane,方法很多

要回复问题请先

商务合作
商务合作