Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old July 7th, 2008, 04:39 PM   #1
New Member
 

Join Date: Jul 2008
Location: Ireland
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 davidrocastle is on a distinguished road
hyperlinking array values

Hello

I was wondering if someone could help me with hyperlinking an array value. What i am currently doing in asp and javascript is retrieving data from an excel spreadsheet based on a drop down list. It works correctly but i want to hyperlink the values that get returned from the drop down list.

My code looks like this
Code:
<script language="javascript"> 
function getdetails() { 
   var cust = document.getElementById("customers").value; 
   <%if strAddDetails = 2 then%> 
      var custnames = new Array(5); 
      <%for c = 0 to ct%> 
         custnames[<%=c%>] = new Array(5); 
         custnames[<%=c%>][0] = "<%=CustomerArray(0, c)%>"; 
         custnames[<%=c%>][1] = "<%=CustomerArray(1, c)%>"; 
         custnames[<%=c%>][2] = "<%=CustomerArray(2, c)%>"; 
         custnames[<%=c%>][3] = "<%=CustomerArray(3, c)%>"; 
         custnames[<%=c%>][4] = "<%=CustomerArray(4, c)%>"; 
         custnames[<%=c%>][5] = "<%=CustomerArray(5, c)%>";  
      <%next%> 
   <%end if%> 
   var spancust = ""; 
   if (document.getElementById("customers").selectedIndex > 0) { 
      var sc; 
      <%if strAddDetails = 2 then%> 
         for (var b =0;b<=<%=ct%>;b++) { 
            sc = custnames[b][0]; 
            if (sc == cust) { 
            if (custnames[b][1] != '') { 
               spancust += ("<b>SheetForm1: </b> " + custnames[b][1] + "<br />");} 
            if (custnames[b][2] != '') { 
               spancust += ("<b>SheetForm2: </b> " + custnames[b][2] + "<br />");} 
            if (custnames[b][3] != '') { 
               spancust += ("<b>SheetForm3: </b> " + custnames[b][3] + "<br />");} 
            if (custnames[b][4] != '') { 
               spancust += ("<b>SheetForm4: </b> " + custnames[b][4] + "<br />");} 
            if (custnames[b][5] != '') { 
               spancust += ("<b>SheetForm5: </b> " + custnames[b][5] + "<br />");} 
            } 
         } 
      <%end if%> 
   } 
   document.getElementById("customerspan").innerHTML = spancust; 
} 
</script>
At the moment when a drop down is clicked a value is found in an excel spreadsheet.
What i want is to have a hyperlink here on my output to hyperlink to a dcoument based on the value returned for custnames[b][1]
I have a variable called strPath which remains contant.
I have tried the following but no luck
Code:
strPath = "file://myserver/customer documents/
            if (custnames[b][1] != '') { 
               spancust += ("<b>SheetForm1: </b> " + custnames[b][1] + "href=<%strPath%> + custnames[b][1]" + "<br />");}
davidrocastle is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old July 7th, 2008, 05:08 PM   #2
Most Reputable Member
 

Join Date: Feb 2008
Location: In My Own Little World
Age: 16
Posts: 1,345
Blog Entries: 9
Thanks: 2
Thanked 45 Times in 45 Posts
Rep Altering Power: 0 CloudedVision is on a distinguished road
Re: hyperlinking array values

So you want to display the excel file, but then also have a link directly to the excel file, correct?

You should be using ASP (it looks like thats the language you code in) if you can for this.
__________________
Theron Luhn
CloudedVision is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old July 8th, 2008, 02:21 AM   #3
New Member
 

Join Date: Jul 2008
Location: Ireland
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 davidrocastle is on a distinguished road
Re: hyperlinking array values

Hey Thanks for replying

I am using ASP but the code that uses the drop down and displays the results of the drop down is javascript.

What i have is ASP/Javascript file that call the excel range. With the hyperlink i want to be able to link to word documents.

strPath = "file://myserver/Documents/

will remain the same
Code:
if (custnames[b][1] != '') { 
               spancust += ("<b>SheetForm1: </b> " + custnames[b][1] + "href=<%strPath%> + custnames[b][1]" + "<br />");}
custnames[b][1] will change as the drop down selects another value. I just can't display custnames[b][1] in my hyperlink
davidrocastle is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old July 8th, 2008, 02:50 PM   #4
Most Reputable Member
 

Join Date: Feb 2008
Location: In My Own Little World
Age: 16
Posts: 1,345
Blog Entries: 9
Thanks: 2
Thanked 45 Times in 45 Posts
Rep Altering Power: 0 CloudedVision is on a distinguished road
Re: hyperlinking array values

You gotta little syntax typo in your code. Try this:

Code:
if (custnames[b][1] != '') { 
               spancust += ("<b>SheetForm1: </b> " + custnames[b][1] + "href=<%strPath%>" + custnames[b][1] + "<br />");}
__________________
Theron Luhn
CloudedVision is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlinking PHP/SQL search results andrwleong PHP 9 March 26th, 2008 01:09 PM
Problem with navbar background image - hyperlinking whitespace nicky77 HTML, XHTML and CSS 5 August 23rd, 2007 10:39 AM
Setting Form Values to Previously Entered Values masonbarge PHP 6 October 17th, 2006 01:36 PM
array unable to check another array so as to be displayed Ozeona Flash and ActionScript 1 August 5th, 2005 06:26 AM
Assign string values to integer values of a session variable Andy K Classic ASP 1 July 13th, 2005 04:29 AM


Search Engine Optimization by vBSEO 3.2.0 RC8