使用jquery获取url及url参数的简单实例

/*--获取网页传递的参数--*/ function request(paras) { var url = location.href; var paraString = url.substring(url.indexOf("?")+1,url.length).split("&")

; var paraObj = {} for (i=0; j=paraString[i]; i++){ paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length); } var returnValue = paraObj[paras.toLowerCase()]

; if(typeof(returnValue)=="undefined"){ return ""; }else{ return returnValue; } }调用这个 request就可以了,这里可以调用request("ID")

dw怎么建立jquery

关于这个问题,DW(Dreamweaver)可以通过以下步骤建立jQuery:

1. 在DW中创建一个新的HTML文档。

2. 在<head>标签中添加jQuery的CDN链接或下载jQuery库并将其保存在本地文件夹中,然后将其引用到HTML文档中。

3. 在HTML文档中添加<script>标签,并将jQuery代码放在其中。

例如,以下是一个简单的HTML文档,其中引用了jQuery库并使用了一些简单的jQuery代码:

```html

<!DOCTYPE html>

<html>

<head>

<title>My jQuery Page</title>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

</head>

<body>

<h1>My jQuery Page</h1>

<p>Click the button to hide this paragraph.</p>

<button id="hideBtn">Hide Paragraph</button>

<script>

$(document).ready(function(){

$("#hideBtn").click(function(){

jquery获取url,jquery获取url中的参数

$("p").hide();

});

});

</script>

</body>

</html>

```

在这个例子中,我们引用了jQuery库,并在文档的底部添加了一个jQuery代码块,该代码块使用了jQuery的$符号来选择和操作HTML元素。当用户单击按钮时,jQuery代码会隐藏页面中的段落元素。