VB SCript

Results 1 to 2 of 2

Thread: VB SCript

  1. #1
    Join Date
    Dec 1969

    Default VB SCript

    Hi folks:<BR><BR>I am new to ASp.Net and am struggling with a problem that I am hoping someone can please help me with. <BR><BR>I have a page with two frames. A user clicks a button in one frame to add an item to a shopping cart and this should update a running total of items in the shopping cart in the other frame. I was able to write a VBScript as follows to do this. The problem is that this script should run after the ASP code that updates the session variable that holds the number of items in the cart (explicitly linked to the onclick even in the button control).<BR><BR>&#060;script language="VBScript"&#062;<BR><BR>Sub AddtoCartbtn_onClick<BR> set win = top.frames(2)<BR> win.History.go 0<BR>End Sub<BR><BR>&#060;/script&#062;<BR><BR>But I cannot seem to control the order in which this routine and the ASP code execute. <BR><BR>I tried to add the runat=server command to the VBSCript sub and call it from within the ASP code. But it now gives me the error message that "set and win assignment statements are no longer supported." What is the replacement for these statements?<BR><BR>Is there a way to ensure that the VBscript runs after the ASP code? Is there any other way to solve this problem?<BR><BR>Any help would be tremendously appreciated. Thanks a lot.<BR><BR>Vivek

  2. #2
    Join Date
    Dec 1969

    Default RE: VB SCript

    Vivek,<BR><BR>I don&#039;t know if I would use vbscript in this way. I think what you are trying to do might be better served using a client side javascript that gets rendered with your page:<BR><BR>&#060;script language=Javascript&#062;<BR>function buttonclick(id){<BR>window.location.frames[2].location = &#039;nameofyourotherpagehere.aspx?id=&#039; + id;<BR>}<BR>&#060;/script&#062;<BR>Then in your button add the onclick command and call that javascript. I like that way much better because your clients only have to support javascript 1.0.<BR><BR>However, I just read something in the documentation that I would have to play with. I think if you use a hyperlink button you can set the target. I haven&#039;t used it yet, but I am assuming that what that will do is create the client side javascript for you.<BR><BR>hth.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts