Go Back   Ultimate Web Site Drop Down Menu Forum > Web Development > Javascript
Register FAQ Members List Calendar Today's Posts

Reply
Thread Tools Display Modes
Unread 01-10-2008, 08:32 AM
ISMAILC ISMAILC is offline
Member
Join Date: Dec 2007
Posts: 45
  #1  
Question 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
Reply With Quote
Unread 01-11-2008, 03:33 AM
vinyl-junkie vinyl-junkie is offline
Moderator
Join Date: Aug 2007
Posts: 114
  #2  
Default

Here is a page that discusses a few different ways of doing this. Hope it helps.
__________________
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
SNAP to it!
Reply With Quote
Unread 01-11-2008, 07:58 AM
ISMAILC ISMAILC is offline
Member
Join Date: Dec 2007
Posts: 45
  #3  
Default 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>
Reply With Quote
Reply



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 11:59 PM.


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