Reply
Moving a variable value
Old 12-05-2005, 08:20 PM Moving a variable value
bman's Avatar
Skilled Talker

Posts: 85
Location: USA
Trades: 0
Very new to javascript.

Can someone point me to and example of how to pull a variable value out of "get” (from a form), and put it in a java variable?

Thanks!
bman is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 12-05-2005, 11:04 PM
funkdaddu's Avatar
Web Design Snob

Posts: 636
Trades: 0
There isn't an object to do it directly AFIK, you need to use a custom function... here's one I use:
Code:
	function cbegeturlArguments() { 
		var params = new Array(); 
		if (location.search) { 
			var pairs = location.search.substring(1, location.search.length).split("&"); 
			for (var i=0; i<pairs.length; i++) { 
				nameVal = pairs[i].split("="); 
				params[i] = nameVal[1]; 
				params[nameVal[0]] = nameVal[1]; 
			} 
		} 
		return params;
	}
Then you call the "GET" variables into an array:

var urlArgs = cbegeturlArguments();

and then you can call them by name from that array:

www.yoursite.com/page.html?color=blue

alert(urlArgs["color"]);

will alert "blue" - you dig? Also, Java and Javascript are 2 different things... was this what you were looking for?

Last edited by funkdaddu; 12-05-2005 at 11:17 PM..
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to Moving a variable value
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.08206 seconds with 13 queries