简体   繁体   中英

query string in javascript function

i have written the below code now i want to check whether the below code is write bcoz when i run the program it gives me a error help needed am i doing something wrong in below code if yes plz rectify me

im not sure how to pass query string throrugh javascript

Page.ClientScript.RegisterClientScriptBlock
    (this.GetType(), "OnClick", "<script language=javascript>window.opener.location.href='~/Home.aspx?Flag= + iFlag + &BetaFlag= + iFlagBeta + &iManuf= + iManuf';</script>"
);

thanks in advance

它似乎是在字符串创建中的问题。

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OnClick", "<script language=javascript>window.opener.location.href='~/Home.aspx?Flag=" + iFlag + "&BetaFlag=" + iFlagBeta + "&iManuf=" + iManuf + "';</script>");

Try this:

Page.ClientScript.RegisterClientScriptBlock
    (this.GetType(), "OnClick", 
    @"<script language=javascript>
        window.opener.location.href='~/Home.aspx?Flag=" + iFlag + "&BetaFlag=" + iFlagBeta + "&iManuf=" + iManuf + "';</script>"
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM