Some help on passing a parameter in text HTML(javascript)?
Hi, I need help please
I usually code in coldfusion but now i want to create 2 text html files where i pass a parameter on href? This normally works in coldfusion! Page1 <a href="test.htm?test=100','','height=300,width=300" > Page2 <html> <head> <param name="test" value=""/> </head> <body> <cfoutput> #test# </cfoutput> </body> </html> It displays #test# but in the url i can see the value it's passing but the second page does not pick it up! Assist"Without some kind of server-side processing (PHP, ColdFusion, etc.) or some fancy JavaScript, you aren't going to be able to display a URL variable. Raw HTML can't do that" Does anyone have an example of some javascript/ or other that can do it? Regards |
Here is a page that discusses a few different ways of doing this. Hope it helps. :)
|
Thank You
Hi, Thank You i got it going with Help!
Fancy Javascript was needed: Regards, <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> ;(function(){ var field='Something', //set the name of the field getQval = function (n) { var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=location.search; return (m=r.exec(m))? unescape(m[1]) : null; }, updateForm = function() { var fname=getQval('fname')? getQval('fname') : 0; document.forms[fname].elements[field].value=val; }, val=getQval(field); if(val){ if ( typeof window.addEventListener != "undefined" ) window.addEventListener( "load", updateForm, false ); else if ( typeof window.attachEvent != "undefined" ) window.attachEvent( "onload", updateForm ); else { if ( window.onload != null ) { var oldOnload = window.onload; window.onload = function ( e ) { oldOnload( e ); updateForm(); };} else window.onload = updateForm;}}})(); </script> </head> <body> <form action="ajax.htm"> <div> <input type="text" name="Something"> </div> </form> </body> </html> |
All times are GMT. The time now is 09:07 PM. |
Powered by vBulletin® Version 3.0.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.