Ultimate Web Site Drop Down Menu Forum

Ultimate Web Site Drop Down Menu Forum (http://www.udm4.com/forum/index.php)
-   Javascript (http://www.udm4.com/forum/forumdisplay.php?f=9)
-   -   Some help on passing a parameter in text HTML(javascript)? (http://www.udm4.com/forum/showthread.php?t=843)

ISMAILC 01-10-2008 07:32 AM

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

vinyl-junkie 01-11-2008 02:33 AM

Here is a page that discusses a few different ways of doing this. Hope it helps. :)

ISMAILC 01-11-2008 06:58 AM

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 01:28 PM.

Powered by vBulletin® Version 3.0.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.