jQuery和GET方法 [英] jQuery and the GET method
问题描述
我编写了一个jQuery程序并将其插入到我的Page1.aspx文件中。 js-url.js驻留在基本文件夹的Scripts文件中。我有一个网站进入这个页面:
http://www.mypage.com/Page1.aspx?var1=123&var2=987
这个jQuery代码假设从url中提取变量var1和var2,并将它们分别放入TextBox1和TextBox2。我不确定js-url.js是否是正确的脚本。
如果有人知道提取这些变量的更好或相同的方式,请告诉我。 />
I have written a jQuery program and inserted it into my Page1.aspx file. js-url.js resides in the Scripts file in the base folder. I have a website coming into this page:
http://www.mypage.com/Page1.aspx?var1=123&var2=987
This jQuery code is suppose to extract the variables var1 and var2 from the url and place them into TextBox1 and TextBox2 respectively. I am not sure if js-url.js is the correct script.
If someone knows a better or the same way to extract these variables please show me.
<script src="../Scripts/js-url.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
var GET1=$("#TextBox1");
var GET2=$("#TextBox2");
GET1.val($.url("?var1"));
GET2.val($.url("?var2"));
});
</script>
推荐答案
(document).ready( function (){
var GET1 =
(document).ready(function() { var GET1=
( #TextBox1);
var GET2 =
("#TextBox1"); var GET2=
( #TextBox2 );
GET1.val(
("#TextBox2"); GET1.val(
这篇关于jQuery和GET方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!