/    Sign up×
Community /Pin to ProfileBookmark

A simple javascript question

Hey all,

I have changed this question because the code I pasted before was not readable. I have also pasted this problem at another forum in a desperate attempt to find a solution so if anyone else comes accross this twice I am sorry. Any here is what I mean

I need the result of this drop down menu
[url]www.aboveproductions.com.au/chained.html[/url]

to fill in a variable field on this button
[url]http://www.aboveproductions.com.au/add.html[/url]

the .js files for the two files can be found here
[url]http://www.aboveproductions.com.au/jsfoundhere.htm[/url]

Cheers. ?

Echo

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@robo_neojetsamApr 10.2005 — Im sorry, i cant help you, i wish i could though.
Copy linkTweet thisAlerts:
@EchostormauthorApr 10.2005 — this question has been re written. See above
Copy linkTweet thisAlerts:
@UltimaterApr 10.2005 — Why not start by simplifying your problem so others don't need to read-through all of your JS files!

So when you submit your form, your script factors-down to this:
[code=html]
<form action="add.html">
<select name="site"><option value="submit this result">result1</option><option value="submit this result">result2</option></select>
<input type="submit" value="this would be the add button on the other script">
</form>
[/code]


All you need to do then is make your add.html program read the query string.
Copy linkTweet thisAlerts:
@UltimaterApr 10.2005 — You should save my above code in a file called [color=royalblue]chained.html[/color] and create another file in the same folder and call it [color=royalblue]add.html[/color]

Source of add.html :
[code=html]
<script language="JavaScript" type="text/javascript">
var query_string=document.location.search.substr(1)
var InfoArray=query_string.split("&")
var $in=[]
for(var i=0;i<InfoArray.length;i++)
$in[InfoArray[i].split("=")[0]]=unescape(InfoArray[i].split("=")[1].replace(/+/g," "))
</script>
<script language="JavaScript" type="text/javascript">
alert($in["site"])
</script>
[/code]
Copy linkTweet thisAlerts:
@robo_neojetsamApr 11.2005 — Ultimater's allways got the answer ?
Copy linkTweet thisAlerts:
@EchostormauthorApr 11.2005 — Is it possible to have the generated and interpreted form on the same page? i.e. combining add.html with chained.html. so they are on the same.html page?
Copy linkTweet thisAlerts:
@UltimaterApr 11.2005 — [code=html]
<script language="JavaScript" type="text/javascript">
var query_string=document.location.search.substr(1)
var InfoArray=query_string.split("&")
var $in=[]
for(var i=0;i<InfoArray.length;i++)
$in[InfoArray[i].split("=")[0]]=unescape(InfoArray[i].split("=")[1].replace(/+/g," "))
</script>
<script language="JavaScript" type="text/javascript">
if(typeof $in["site"]!="undefined")alert($in["site"])
</script>
<form action="chained.html">
<select name="site"><option value="submit this result">result1</option><option value="submit this result">result2</option></select>
<input type="submit" value="this would be the add button on the other script">
</form>
[/code]
Copy linkTweet thisAlerts:
@UltimaterApr 11.2005 — You can also make the FORM invisible after the script recieves a query string:
[code=html]
<script language="JavaScript" type="text/javascript">
var query_string=document.location.search.substr(1)
var InfoArray=query_string.split("&")
var $in=[]
for(var i=0;i<InfoArray.length;i++)
$in[InfoArray[i].split("=")[0]]=unescape(InfoArray[i].split("=")[1].replace(/+/g," "))
</script>
<script language="JavaScript" type="text/javascript">
if(typeof $in["site"]!="undefined")alert($in["site"])
else{
document.write('<form action="chained.html">');
document.write('<select name="site"><option value="submit this result">result1</option><option value="submit this result">result2</option></select>');
document.write('<input type="submit" value="this would be the add button on the other script">');
document.write('</form>');
}
</script>
[/code]
×

Success!

Help @Echostorm 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.18,
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,
)...