PDA

Click to See Complete Forum and Search --> : SelectedText, Hyperlinks, and QueryString


joey o.
Nov 6th, 2000, 11:02 AM
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>

monte96
Nov 6th, 2000, 11:17 AM
BTW-

I thought you NEEDED Javascript....


<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...

joey o.
Nov 6th, 2000, 01:02 PM
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"

monte96
Nov 6th, 2000, 02:01 PM
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:


<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>

joey o.
Nov 6th, 2000, 08:44 PM
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!