Results 1 to 5 of 5

Thread: SelectedText, Hyperlinks, and QueryString

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Hi,
    monte96 was good enough to get me to this point in my code.Although I'd rather be using vbscript beggers can't be choosers. This code is fine for just one hyperlink, but I want to pass the combobox text with any link, not just "header.asp". In the real code the link is made within the same loop using '<%=QueryD("Stuff")%>.asp'.Please,Please help. This is the last thing I need to complete my project.


    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function blah()
    {
    var strURL;
    strURL = Tcode.options(Tcode.selectedIndex).innerText;
    strURL = "header.asp?Tcode=" + strURL + "&" + "pass=" + pass.value;
    location.href=strURL
    }
    -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <!--Do all the DB Connect stuff here-->
    <%Set QueryD = Connect.Execute (Qstr)%>
    <TABLE>
    <%Do Until QueryD.EOF%>
    <TR>
    <td>
    <b><a href="javascript:blah()">
    Request for <%=QueryD("Stuff")%></a></b><br>
    </td>
    </TR>
    <%QueryD.MoveNext%>
    <%loop%>
    </Table>
    </BODY>
    </HTML>

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    BTW-

    I thought you NEEDED Javascript....

    Code:
    <SCRIPT LANGUAGE="VBScript"> 
    <!-- 
    Sub blah) 
    Dim strURL
    strURL = Tcode.options(Tcode.selectedIndex).innerText 
    strURL = "header.asp?Tcode=" & strURL & "&" & "pass=" & pass.value
    location.href=strURL 
    End Sub
    --> 
    </SCRIPT> 
    
    <a href="vbscript:blah">whatever</a>
    Not sure I'm totally following what your asking this time though...


    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Oh-Oh-No,
    I don't know diddley about javascript.I need one more step though. That is to be able to change the actual link so that I'm still getting the Query string on whatever different link I press.I need this because I have over 50 links created through the text in a column in the database.Can you help my Suedo code that doesn't work to do this:


    <SCRIPT LANGUAGE="VBScript">
    <!--
    Sub blah()
    Dim strURL
    strURL = Tcode.options(Tcode.selectedIndex).innerText

    SelectCase num 'Which pagelink was pushed?
    Case 1
    strURL = "page" & num & ".asp?Tcode=" & strURL & "&" & "pass=" & pass.value
    Case 2
    strURL = "page" & num & ".asp?Tcode=" & strURL & "&" & "pass=" & pass.value
    Case 3
    strURL = "page" & num & ".asp?Tcode=" & strURL & "&" & "pass=" & pass.value
    Case 4
    ect...
    End Select

    location.href=strURL
    End Sub
    -->
    </SCRIPT>

    <body>
    <!-- How do I get num to be evaluated in blah()?-->
    <%dim num%>
    <%For num = 1 to RS.EOF%>
    <a href="vbscript:blah<%=(num)%>>whatever<%=(num)%></a>
    num=num+1
    RS.MoveNext
    Next
    ***********************
    So now if I push the page5 link, I want to get page5 on my screen with the selected text from the dropdown available to this page as well as the variable "pass"

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    I think I see what your trying to do. The best thing to do here is to store your pagename and pass it into the procedure like:

    Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="VBScript"> 
    <!-- 
    Sub MyRedirect(strPageName) 
    Dim strURL 
    strURL = Tcode.options(Tcode.selectedIndex).innerText 
    
    strURL = strPageName & "?Tcode=" & strURL & "&" & "pass=" & pass.value 
    
    location.href=strURL 
    End Sub 
    --> 
    </SCRIPT>
    </HEAD>
    <BODY bgcolor=white text=black marginheight="0" topmargin="0"> 
    <%
    Dim intCount
    
    intCount = 0
    Do Until rs.EOF
        intCount = intCount + 1
    'This next part is courtesy of Serge..
        Response.Write "<U><P style='cursor=hand' OnClick=MyRedirect('page" & intCount & ".asp'>Page #" & intCount & "</P></U>"
        rs.MoveNext 
    Loop
    %>
    </BODY>
    </HTML>
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    You guys have been awsome!

    Thank you so much! It took a while but I'm finally starting to understand this stuff enough to know I need some real education on the subject of client-side scripting. I've got enough to get through my current project at present from you guys, but if there's going to be more I'm going to need my own tools (just in case you(monte96) or Surge go on vacation or something!). Could someone recommend a good source for VB-Client side scripting? I prefer streight to the point books as apposed to page upon page of explanations. If anyone has a recommedation please let me know.(Monte96: Yes this means I'm not taking the demotion!)
    Thanks Everyone!

Posting Permissions

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



Click Here to Expand Forum to Full Width