|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I am desperatly trying to retrieve the quesrystring from a javascript src tag. I.E <SCRIPT LANGUAGE = "JAVASCRIPT" SRC = "http://mydomain/script.js?h=1&b=2"></SCRIPT> Van anyone give me a clue on how to retrieve the values for h and b in this instance? |
|
#2
|
|||
|
|||
|
link.search will return the search portion of a URL. Suppose the link http://www.mine.com?x=1&y=4#bookmark is the fifth link on your page (in the order it appears in the code). Then:
document.links[4].search should return ?x=1&y=4 At this point, you can use your string functions to take it apart and determine your values. On simpler data values passes through a URL, I tend to send them as a value only. This works especially well if your variables have the values of 0 thru 9 [ie:single digit or at least a set number of digits]. This way, if I pass the values 3 & 7, I can retrieve the string ?37 which is much easier to take apart and pass where ever it is your are sending them. Russ |
|
#3
|
|||
|
|||
|
Hi and thanks for the reply.
Suppose I don't know where this link will appear on the page? Any tips on how to handle that? Thanks! Gerard |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > JS SRC tag and querystring |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|