# 如何獲得價值

Using C# & Java Script

"http://localhost/Server/Vehicle/Vehicle.aspx?appid=5", when i use this link the page is opening... But i want to get this appid value, then pass this appid value to another link

Link1 http://localhost/Server/Vehicle/Vehicle.aspx?appid=5

Entry


http://localhost/Server/Vehicle/car.aspx?param=document.getElementById('appid').value


## 最佳答案

string appid = Request.QueryString["appid"];


Update:

JavaScript代碼段不會在鏈接的 href 屬性中執行（它被識別為普通字符串，不會被解析為JavaScript代碼）。

Entry


Side note: the value property works only for HTML tags that have defined an eponymous attribute. One such tag would be the input tag. The div tag instead doesn't have a value attribute defined, and therefore document.getElementById('appid').value would fail; use innerHTML instead in that case.