Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move a dynamic link on a page

Status
Not open for further replies.

brimike

MIS
Feb 14, 2006
26
US
Hello All,
I am trying to move a dynamic link on a page. The section connects to a db accesses an email variable and will be used to process a form, however I can't seem to get the link placemnt where it needs to be on the page.

--I Need this link to display at the top of the page----


Response.Write "<a href='contactustest1.asp?mls=" _
& varMLS & "&LID=" & varLID & "&Associate=" & varAssociate _
& "&AgentEmail=" & AgentEmail & "'><span class='style10'>" _
& "Request Additional Information</span></a><br>" & vbCrLf





---------------------------FULL PAGE CODE-----------------
<link href="globaldynamic.css" type="text/css">
<%
Response.Buffer = True
varMLS = Trim(Request("mls"))
IF TRIM(varMLS) = "" THEN
varMLS = Trim(Request("lid"))
END IF
IF TRIM(Request.QueryString("LAID")) <> "" THEN
varListingAgent = TRIM(Request.QueryString("LAID"))
END IF
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=er;PWD="
SQL = "SELECT * FROM current_listings WHERE (Status='A') "
IF Trim(varMLS) <> "" THEN
SQL = SQL & " AND (MLS# = '" & varMLS & "' OR LID = '" & varMLS & "')"
END IF
IF Trim(varListingAgent) <> "" THEN
SQL = SQL & " AND (Associates_Last_Name = '" & varListingAgent & "' OR Listing_Assoc2 = '" & varListingAgent & "' OR Listing_Assoc3 = '" & varListingAgent & "')"
END IF

'response.write "sql=" & sql & "<br>"

Set rs = Server.CreateObject("ADODB.Recordset")
'response.write "<br>SQL = " & sql & "<br>"
rs.Open sql, conn, 3, 3

%>

<%If NOT rs.EOF THEN
varLID = quoteIt(trim(rs("LID")))
varDate_Entered = quoteIt(trim(rs("Date_Entered")))
varOfficeNumber = quoteIt(trim(rs("OfficeNumber")))
varPS_Date = quoteIt(trim(rs("PS_Date")))
varPC_Date = trim(rs("PC_Date"))
varClose_Sale_Date = quoteIt(trim(rs("Close_Sale_Date")))
varMLS = quoteIt(trim(rs("MLS#")))
varOther_MLS = quoteIt(trim(rs("Other_MLS#")))
varClass = quoteIt(trim(rs("Class")))
varZone = quoteIt(trim(rs("Zone")))
varStatus = quoteIt(trim(rs("Status")))
varVillage_Key = quoteIt(trim(rs("Village_Key#")))
varOld_Naples_Key = quoteIt(trim(rs("Old_Naples_Key#")))
varVanderbilt_Key = quoteIt(trim(rs("Vanderbilt_Key#")))
varPelican_Landing = quoteIt(trim(rs("Pelican_Landing#")))
varProperty = quoteIt(trim(rs("Property")))
varProperty_Address = quoteIt(trim(rs("Property_Address")))
varPrice = quoteIt(trim(rs("Price")))
IF varPrice <> "" Then
varPrice = formatcurrency(varPrice,0)
End IF
varLower_List_Price = quoteIt(trim(rs("Lower_List_Price")))
varCommPercntSell = quoteIt(trim(rs("CommPercntSell")))
varCommPercntList = quoteIt(trim(rs("CommPercntList")))
varTotalCommPercnt = quoteIt(trim(rs("TotalCommPercnt")))
varOtherPrice = quoteIt(trim(rs("OtherPrice")))
varSignReqd = quoteIt(trim(rs("SignReqd")))
varOwnerName = quoteIt(trim(rs("OwnerName")))
varOwners_Last_Name = quoteIt(trim(rs("Owners_Last_Name")))
varFirst_Name = quoteIt(trim(rs("First_Name")))
varSpouse_Name = quoteIt(trim(rs("Spouse_Name")))
varPrefix = quoteIt(trim(rs("Prefix")))
varSecond_Owner_or_Co = quoteIt(trim(rs("Second_Owner_or_Co")))
varMailing_Address = quoteIt(trim(rs("Mailing_Address")))
varCity = quoteIt(trim(rs("City")))
varState = quoteIt(trim(rs("State")))
varZip = quoteIt(trim(rs("Zip")))
varCountry = quoteIt(trim(rs("Country")))
varHome_Phone = quoteIt(trim(rs("Home_Phone")))
varOffice_Phone = quoteIt(trim(rs("Office_Phone")))
varFax_Number = quoteIt(trim(rs("Fax_Number")))
varUnit_Phone_Number = quoteIt(trim(rs("Unit_Phone_Number")))
varAssociates_Last_Name = quoteIt(trim(rs("Associates_Last_Name")))
varList_Date = quoteIt(trim(rs("List_Date")))
varExp_Date = quoteIt(trim(rs("Exp_Date")))
varLA = quoteIt(trim(rs("LA")))
varTA = quoteIt(trim(rs("TA")))
varBR = quoteIt(trim(rs("BR")))
varBA = quoteIt(trim(rs("BA")))
varFurnished = quoteIt(trim(rs("Furnished")))
varShowing_Instructions = quoteIt(trim(rs("Showing_Instructions")))
varCondo_Sub = quoteIt(trim(rs("Condo_Sub")))
varC_S_Address = quoteIt(trim(rs("C_S_Address")))
varAd__newspaper = quoteIt(trim(rs("Ad_#__newspaper_")))
varAd_Copy = quoteIt(trim(rs("Ad_Copy")))
varBanner = quoteIt(trim(rs("Banner")))
varAssociate = quoteIt(trim(rs("Associate")))
varKeybox = quoteIt(trim(rs("Keybox")))
varListing_Assoc2 = quoteIt(trim(rs("Listing_Assoc2")))
varListing_Assoc3 = quoteIt(trim(rs("Listing_Assoc3")))
varRange_Code = quoteIt(trim(rs("Range_Code")))
varRange = quoteIt(trim(rs("Range")))
varIproperty_Type = quoteIt(trim(rs("Iproperty_Type")))
varProperty_Address = quoteIt(trim(rs("Property_Address")))
varIneighborhood = quoteIt(trim(rs("Ineighborhood")))
varIcatagory = quoteIt(trim(rs("Icatagory")))
varIlocation = quoteIt(trim(rs("Ilocation")))
varRemove_Date = quoteIt(trim(rs("Remove_Date")))
varHalfbath = quoteIt(trim(rs("Halfbath")))
varZip1 = quoteIt(trim(rs("Zip1")))
varYear_Built = quoteIt(trim(rs("YearBuilt")))
varVirtual_Tour = quoteIt(trim(rs("Virtual_Tour")))
'Response.write rs("VirtualTourAddress")
'response.end
varVirtualTourAddress = quoteIt(trim(rs("VirtualTourAddress")))
varAvailableSqFeet = quoteIt(trim(rs("AvailableSqFeet")))
varVTURL = ""
varURL = ""

strAddress = " "
strAddress = varC_S_Address & " " &varZip1
'strAddress = varC_S_Address & " " & varCity & " " & varState & " " &varZip1
strAddress = TRIM(strAddress)
'response.write "strAddress = ||" & strAddress & "||"

'=========================================================================================================
SQL = "SELECT * FROM imgList WHERE (PhotoName LIKE '"& varMLS & "%') AND ((PhotoName NOT LIKE '%FP%')) ORDER BY OrderNumber"
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open sql, conn, 3, 3
If rs2.recordcount <> 0 Then
varPhotoName = trim(rs2("PhotoName"))
varGraphic = " & varPhotoName
Else
varGraphic = "/graphics/no_photo_small.gif"
End If
'=========================================================================================================
End If
'======================================================================================================
' End If
'------------------------------------------------------------------------------------------------------------->
'--[Photo Loop Ends HERE]------------------------------------------------------------------------------------->
'------------------------------------------------------------------------------------------------------------->
%>
<%
'NEW LAYOUT START
%>
<style type="text/css">
<!--
.style5 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; color: #FFFFFF; text-decoration:none; }
#Layer1 {
position:absolute;
width:200px;
height:21px;
z-index:1;
left: 314px;
top: 17px;
}
-->
</style>



<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<link href="globaldynamic.css" rel="stylesheet" type="text/css" />
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#000000">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr align="center" bgcolor="#000000" class="style5">
<td valign="bottom" style="padding:3px;" nowrap><a href="javascript:history.back(1)"><span class="style5">Back to Search Results</span></a></td>
<td valign="bottom" style="padding:3px;" nowrap><a href="javascript:window_open('savelisting.asp?mls=<%=varMLS%>', '400', '450')"><span class="style5">Save Listing to Favorites</span></a></td>


<td valign="bottom" style="padding:3px;" nowrap><font color="#333333">

</font>
<%
SUB GetPhotos(MLS)
SET NewConn=Server.CreateObject("ADODB.Connection")
NewConn = "DSN=er;PW=;"
set rsPhotos=Server.CreateObject("ADODB.recordset")
photoSQL = "SELECT * FROM imgList WHERE MLS ='" & MLS & "' ORDER BY OrderNumber;"
'response.write photoSQL &"<BR><BR>"
'response.write Conn &"<BR><BR>"
rsPhotos.Open photoSQL, NewConn
If NOT rsPhotos.EOF OR NOT rsPhotos.BOF then
FPCOUNT = 0
DIM fpimage

photoTable = "<table border='0' cellpadding='2' cellspacing='1' width='100%' class='resultsCopy'><tr><td><table border='0' cellpadding='3' cellspacing='0' width='100%' ><tr class='resultsCopy'>"
'------------------------------------------------

'------------------------------------------------
Do while not rsPhotos.EOF

k = k + 1
reDim photoarray(k)
IF InStr(rsPhotos("photoName"),"FP") OR InStr(rsPhotos("photoName"),"fp")THEN
FPCOUNT = (FPCOUNT + 1)
FP = TRUE
'FpImage(FPCOUNT)= (rsPhotos("live") & "/" & rsPhotos("photoName"))
'FpImage(FPCOUNT) = (rsPhotos("PID"))
rsPhotos.movenext
ELSE
photoarray(k) = rsPhotos("live") & "/" & rsPhotos("photoName")
'Start Row - Cell Count is Count - 1
'SET MAIN IMAGE
IF count = 0 THEN
PhotoTable = photoTable & "<td rowspan='10' valign='top' class='resultsCopy'><img src='" & rsPhotos("live")&"/"&rsPhotos("photoName") & "' border='0' id='main'></td><td valign='top'><div id='photo"&K&"' style='display:block'><table border='0' cellpadding='0' cellspacing='1' width='100%'><tr>"
END IF
count = (count + 1)
totalCount = (totalCount + 1)
xCount = (xCount + 1)
IF TotalCount = 13 THEN
hide = Cint(K / 12)
show = Cint(hide+1)
prev = Cint(hide-1)
IF hide = 0 THEN
hide =1
END IF
IF prev = 0 THEN
prev =1
END IF
photoTable = photoTable & "</table><table width='100%' cellpadding='3' cellspacing='0' valign='bottom'><tr class='stats'><td valign='bottom' align='left'><a class='resultsCopy' href='javascript:displayDiv(&quot;photo"&hide&"&quot;,&quot;none&quot;);displayDiv(&quot;photo"&prev&"&quot;,&quot;block&quot;);'><< Previous</a></td><td align='right' valign='bottom'><a class='resultsCopy' href='javascript:displayDiv(&quot;photo"&show&"&quot;,&quot;block&quot;);displayDiv(&quot;photo"&hide&"&quot;,&quot;none&quot;);'>Next >></a></td></tr></table></div><div id='photo"&show&"' style='display:none'>"
TotalCount = 1
photoTable = photoTable & "<table border='0' cellpadding='0' cellspacing='1' ><tr class='resultsCopy'>"
END IF

IF Count < 4 AND Count > 0 THEN
PhotoTable = photoTable & "<td valign='top' height='1' class='resultsCopy'><a href='javascript:swapImage(&quot;main&quot;,&quot;&quot;,&quot;" & rsPhotos("live")&"/"&rsPhotos("photoName") & "&quot;);' class='stats'><img src='" & rsPhotos("live")&"/"&rsPhotos("photoName") & "' width='80' height='55' border='0' id='"&rsPhotos("PID")&"'></a></td>"
ELSE
count = 1
PhotoTable = photoTable & "</tr><tr class='resultsCopy'><td valign='top' height='1'><a href='javascript:swapImage(&quot;main&quot;,&quot;&quot;,&quot;" & rsPhotos("live")&"/"&rsPhotos("photoName") & "&quot;);' class='stats'><img src='" & rsPhotos("live")&"/"&rsPhotos("photoName") & "' width='80' height='55' border='0' id='"&rsPhotos("PID")&"'></a></td>"
END IF
rsPhotos.movenext
END IF
loop
rsPhotos.close
SET rsPhotos=NOTHING
SET NewConn=NOTHING
IF (totalCount < 12) AND (xCount > 12) THEN
photoTable = photoTable & "<table width='100%' cellpadding='3' cellspacing='0' valign='bottom'><tr class='stats'><td valign='bottom' align='left' class='resultsCopy'><a class='resultsCopy' href='javascript:displayDiv(&quot;photo"&hide&"&quot;,&quot;block&quot;);displayDiv(&quot;photo"&show&"&quot;,&quot;none&quot;);'><< Previous</a></td><td align='right' valign='bottom'><a class='resultsCopy' href='javascript:displayDiv(&quot;photo"&show&"&quot;,&quot;block&quot;);displayDiv(&quot;photo"&hide&"&quot;,&quot;none&quot;);'>Next >></a></td></tr></table></div>"
END IF

PhotoTable = photoTable & "</table></table></div></table>"
ELSE
PhotoTable = photoTable & "<img src='/graphics/no_photo_large.gif' border='1'></table></div>"
END IF

response.write(photoTable)

':: Show virtual tour if database has the address in the field

If VarVirtualTourAddress <> "" then
Response.write "<a target=_blank href='"&VarVirtualTourAddress&"'><img border='0' src='graphics/home_search_virtual_tour.gif' ></a>"
End if

END SUB

SUB GetFP(MLS)
SET NewConn=Server.CreateObject("ADODB.Connection")
NewConn = "DSN=er;PW=;"
set rsFPPhoto=Server.CreateObject("ADODB.recordset")
photoSQL = "SELECT * FROM imgList WHERE MLS ='" & MLS & "' AND(photoName LIKE '%FP%' OR photoName LIKE '%fp%') ORDER BY OrderNumber;"
rsFPPhoto_Open photoSQL, NewConn
FPCOUNT = 0

If NOT rsFPPhoto.EOF OR NOT rsFPPhoto.BOF then
FPCOUNT = (FPCOUNT + 1)
fpTable = "<table border='0' cellpadding='2' cellspacing='1' width='100%' bgcolor='FFFFFF' class='resultsCopy'><tr><td><b>&nbsp;View Floor Plans "
Do while not rsFPPhoto.EOF
'response.write("<BR>" & rsFPPhoto("live")&"/"&rsFPPhoto("photoName"))

fpTable = fpTable & "<a href='javascript:void window.open(&#39;" & rsFPPhoto("live")&"/"&rsFPPhoto("photoName") & "&#39;,&#39;FloorPlans&#39;,&#39;resizable=1,width=500,height=400&#39;);'>"& FPCOUNT &"</a>&nbsp;"
rsFPPhoto.movenext
LOOP
fpTable = fpTable & "</b></td></tr></table>"
response.write fpTable
fpTable = ""
rsFPPhoto.close
SET rsFPPhoto=NOTHING
SET NewConn=NOTHING

'response.write("TESTING: " & fpTable)
END IF
END SUB
SUB GetAgent(strIn)
IF TRIM(strIn) <> "" THEN
SET NewConn=Server.CreateObject("ADODB.Connection")
NewConn = "DSN=er;PW=;"
set rsAgent=Server.CreateObject("ADODB.recordset")
agentSQL = "SELECT * FROM ASSOCIATES WHERE AgentStatus='Active' AND Last_Name = '" & strIn & "';"
rsAgent.Open agentSQL, NewConn
IF NOT rsAgent.EOF AND NOT rsAgent.BOF THEN
response.write "<table width='100%' cellpadding='3' cellspacing='0' border='0'>"
IF Trim(rsAgent("Picture")) <> "" AND NOT IsNull(rsAgent("Picture")) THEN
strPic = "<a href='agent.asp?aid=" & Trim(rsAgent("LAID")) & "&agent=" & Trim(rsAgent("Last_Name")) & "'><img src='/MultiMedia/agents/"&SERVER.URLENCODE(Trim(lcase(rsAgent("Picture"))))&"' width='100' border='0'></a>"
ELSE
strPic = "<a href='agent.asp?aid=" & Trim(rsAgent("LAID")) & "&agent=" & Trim(rsAgent("Last_Name")) & "'><img src='/images/er/Search/NoAgent.jpg' width='100' border='0'></a>"
END IF
response.write "<tr class='resultsCopy'><td valign='top' align='left' rowspan='7' height='10'>" & strPic & "</td>"
response.write "<td nowrap valign='top'><b><a class='dynamiclinks1' href='agent.asp?aid=" & Trim(rsAgent("LAID")) & "&agent=" & Trim(rsAgent("Last_Name")) & "'>" & Trim(rsAgent("Listing_Associate")) & "</a></b>"
response.write "<br>"
IF Trim(lcase(rsAgent("Title"))) = "realtor" THEN
response.write "Sales Associate/REALTOR<sup><font size='1'>&reg;</font></sup>"
ELSE
response.write Trim(rsAgent("Title"))
END IF
If NOT IsNULL(rsAgent("Address1")) THEN Response.Write("<BR>" & TRIM(rsAgent("Address1")) & "")
If NOT IsNULL(rsAgent("Address2")) THEN Response.Write("<BR>" & TRIM(rsAgent("Address2")) & "")
If NOT IsNULL(rsAgent("City")) THEN Response.Write("<BR>" & TRIM(rsAgent("City")) & "")
If NOT IsNULL(rsAgent("State")) THEN Response.Write(", " & TRIM(rsAgent("State")) & "")
If NOT IsNULL(rsAgent("Zip")) THEN Response.Write("&nbsp;&nbsp;" & TRIM(rsAgent("Zip")) & "")
response.write("<br>")
If NOT IsNULL(rsAgent("phoneNumber1")) THEN Response.Write("<br>Phone: " & TRIM(rsAgent("phoneNumber1")) & "")
If NOT IsNULL(rsAgent("fax1")) THEN Response.Write("<br>Fax: &nbsp;&nbsp;&nbsp;&nbsp;" & TRIM(rsAgent("fax1")) & "")
If NOT IsNULL(rsAgent("email")) THEN Response.Write("<br><a href='mailto:" & TRIM(rsAgent("email")) & "'>Email</a>")

Dim AgentEmail
AgentEmail = rsAgent("email")
Response.Write "<br>"


Response.Write "<a href='contactustest1.asp?mls=" _
& varMLS & "&LID=" & varLID & "&Associate=" & varAssociate _
& "&AgentEmail=" & AgentEmail & "'><span class='style10'>" _
& "Request Additional Information</span></a><br>" & vbCrLf
'----------------------------------------


END IF
rsAgent.close
SET rsAgent = NOTHING
SET NewConn = NOTHING
ELSE
EXIT SUB
END IF
strPic = ""
strIn = ""
END SUB
%></td>
 
OK, so that means the code for setting the values of the following variables must appear BEFORE the link is created:
[tt]
varMLS
varLID
varAssociate
AgentEmail
[/tt]

 
How do I create the link after the connection to the db populates the variables? Thanks
 
It looks like you've already got a subroutine named GetAgent that attempts to output the requested link string.

It looks like the subroutine runs off the Agent's last name...

So, if you want to use this subroutine, add a call to GetAgent at some point in the code below the point where you've got the agent's last name.

 
Hi Sheco,

I tried everything including adding another link on a layer. I don't care if I have to dulpicate the link as long as I can just bring it up higher on the page. I believe I have found a bug in ASP. Asp by default is a compiled language. Why is the link not being compliled as It should. It should not be built like a house but mixed like a milkshake this makes no sense. When I code with C i have no issues like this is VB asp an inferior language. Is ASP.net any better?
 
VBScript is an interpreted language. It is not "inferior" to the C language, it is different. It has a different purpose.

There is no magic C compiler that allows you to pull the value from a variable before it has been assigned. Unlike the new language described below, plain old C does not support the #pragma DWIM compiler directive.



Code:
[b]New Programming Language: C+-[/b]

There's finally a replacement for the common C++ programming language, it's C+- (pronounced "C More or Less").

Unlike C++, C+- is a subject-oriented language. Each C+- class instance, known as a subject, holds hidden members, known as prejudices or undeclared preferences, which are impervious to outside messages, as well as public members known as boasts or claims. The following C operators are overridden as shown:

> better than
< worse than
>> way better than
<< forget it
! not on your life
== comparable, other things being equal

C+- is a strongly typed language based on stereotyping and self-righteous logic. The Boolean variables TRUE and FALSE (known as constants in less realistic languages) are supplemented with CREDIBLE and DUBIOUS, which are fuzzier than Zadeh's fuzzy categories. All Booleans can be declared with the modifiers strong and weak. Weak implication is said to "preserve deniability" and was added at the request of the Department of Defense to ensure compatibility with future versions of ADA. Well-formed falsehoods (WFFs) are assignment-compatible with all booleans. What-if and why-not interactions are aided by the special conditional evenifnot X then Y.

C+- supports information hiding and, among friend classes only, rumor sharing. Borrowing from the Eiffel lexicon, non-friend classes can be killed by arranging contracts. Note that friendships are intransitive, volatile, and non-Abelian.

Operator precedence rules can be suspended with the directive #pragma dwim, known as the "Do what I mean" pragma.

ANSIfication will be firmly resisted. C+-'s slogan is "Be Your Own Standard."


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top