/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottJan 10.2008 — That script will work for the most basic cases, but there's a better alternative at http://www.webdeveloper.com/forum/showthread.php?t=162208.
Copy linkTweet thisAlerts:
@ISMAILCauthorJan 10.2008 — Hi, i looked at the code - it displays a page & onclick submit is displays a popup 'Alert'

I need to call it via a href from page1 to the second page where i can set the style of the output!

Page1: <A HREF='ajax.htm?name'>Click here</A>

Page2: displays the output?

<body>

<form action="test.html" method="get">

<div>

<label>Name<input name="name"></label>

<input type="hidden" name=".submit" value="submit">

<input type="submit" value="Submit">

</div>

</form>

<script type="text/javascript" src="ParsedQueryString.js"></script>
<script type="text/javascript">

var pqs = new ParsedQueryString();

if (Boolean(pqs.param(".submit")))
{
var name = pqs.param("name");
alert("You said your name is " + name + ".");
}

</script>

</body>

</html>
Copy linkTweet thisAlerts:
@Jeff_MottJan 10.2008 — On page one, you would do something like: [font=courier]<a href="page2.html?test=100">a link</a>[/font]. And on page two, you would do something like:var outputDiv = document.getElementById("SomeDivInYourDocument");
outputDiv.innerHTML = "&lt;p&gt;The result was " + pqs.param("test") + "&lt;/p&gt;";
Copy linkTweet thisAlerts:
@ISMAILCauthorJan 11.2008 — Hi, I think I done as advised.

Thank You for the help but as you can see I'm a junior & need assistance, really appreciate it!

[B]

Please Assist - I'm just not getting it (as i don't code in Javascript - more SQL)[/B]


[B][U]Page 1: [/U][/B]<a href="test.html?test=100">a link</a>

[B][U]Page 2: [/U][/B]

<body>

<form action="test.html" method="get">

<div id="test2" style="width:200px; height:30px;"></div>

</form>

<script type="text/javascript" src="ParsedQueryString.js"></script>

<script type="text/javascript">

var pqs = new ParsedQueryString();

var outputDiv = document.getElementById("test2");

outputDiv.innerHTML = "<p>The result was " + pqs.param("test") + "</p>";

</script>

</body>

</html><!--SomeDivInYourDocument-->

Thank You - Regards
×

Success!

Help @ISMAILC spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...