gpt4 book ai didi

javascript - 如何在 中调用 javascript 函数?

转载 作者:行者123 更新时间:2023-11-30 12:48:39 25 4
gpt4 key购买 nike

<分区>

我还需要知道如何在“src”中调用 javascript 函数

<input type=text>

我正在使用一个返回查询字符串参数的函数

function GetUrlValue(VarSearch) {
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for (var i = 0; i < VariableArray.length; i++) {
var KeyValuePair = VariableArray[i].split('=');
if (KeyValuePair[0] == VarSearch) {
return KeyValuePair[1];
}
}
}

如果:

"www.testweb.com?a=521&b=http://demo.sacredpixel.com/redsky/wp/modern/wp-content/uploads/2013/05/gd-1.jpg"

所以它会返回

alert(GetUrlValue('a')); ===> 521

但我需要的是在 img 中调用此函数并输入类型“文本” 标签……比如:

<iframe src="" id="well" width="100%" height="100%" />
<input type="text" value="" />

如何调用上面两个函数?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com