js获取地址栏参数document.getElementById("").innerHTML

js获取地址栏参数document.getElementById("").innerHTML,第1张

可以用正则表达式实现。

windowlocationsearch

是你的查询字符串

"id=123"

用下面的正则表达式提取出查询字符串的值

/[\&]id=([^&=])/i

所以就有下面的代码:

var matches = /[\&]id=([^&=])/iexec(windowlocationsearch), id

if(!matches) {

  // 参数不正确:没有指定 id,可以在这里做一些其他的处理

}

else {

  id = decodeURIComponent(matches[1])

  // 这就拿到 ID 了

}

iframe:

content: '<iframe id="iframe1" src="" style="" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>'

方法:

var a = documentgetElementById('iframe1')contentWindowdocumentgetElementById('a)value; //输入值

var a= documentgetElementById('iframe1')contentWindowdocumentgetElementById('a')defaultValue; //默认值

以上就是关于js获取地址栏参数document.getElementById("").innerHTML全部的内容,包括:js获取地址栏参数document.getElementById("").innerHTML、在qq邮箱或163邮箱登录界面,怎么用js从frame里的document获取文本框、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9290252.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-26
下一篇2023-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存