/    Sign up×
Community /Pin to ProfileBookmark

Alternative to window.location.href

Is there an alternative to using window.location.href to define a href using javascript. A way that can still contain values from a form?

TIA

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@fredmvJan 08.2004 — What exactly are you trying to do? Sure enough, a simple form along with a submit button would do just that.
Copy linkTweet thisAlerts:
@tcovertauthorJan 08.2004 — Here is my current link on a button:

<a href="#" onclick="dl = document.testForm;window.location.href = 'up-aoe.php?orderid='+document.testForm.orderid.value+'&array='+build()+'&team='+dl.team.value+'&signaturead='+dl.signaturead.value+'&customer='+dl.customer.value+'&acctnumber='+dl.acctnumber.value+'&acctname='+dl.acctname.value+'&atexno='+dl.atexno.value+'&ponumber='+dl.ponumber.value+'&adtype='+dl.adtype.value+'&salesrep='+dl.salesrep.value+'&adcaption='+dl.adcaption.value+'&columns='+dl.columns.value+'&inches='+dl.inches.value+'&fullcolor='+dl.fullcolor.value+'&color1check='+dl.color1check.value+'&color1='+dl.color1.value+'&color2check='+dl.color2check.value+'&color2='+dl.color2.value+'&reqcolorovercheck='+dl.reqcolorovercheck.value+'&reqcolorover='+dl.reqcolorover.value+'&layoutcomplete='+dl.layoutcomplete.value+'&copytocome='+dl.copytocome.value+'&adsend='+dl.adsend.value+'&disc='+dl.disc.value+'&specialposreqcheck='+dl.specialposreqcheck.value+'&specialposreq='+dl.specialposreq.value+'&email='+dl.email.value+'&web='+dl.web.value+'&ftp='+dl.ftp.value+'&pickupwchange='+dl.pickupwchange.value+'&pickupwcorrect='+dl.pickupwcorrect.value+'&othercheck='+dl.othercheck.value+'&other='+dl.other.value+'&emailwebftp='+dl.emailwebftp.value+'&prevrundate='+dl.prevrundate.value+'&prevadnumber='+dl.prevadnumber.value+'&coupon='+dl.coupon.value+'&dbltruck='+dl.dbltruck.value+'&coopcheck='+dl.coopcheck.value+'&coop='+dl.coop.value+'&reqadrateovercheck='+dl.reqadrateovercheck.value+'&reqadrateover='+dl.reqadrateover.value+'&proofnumber='+dl.proofnumber.value+'&proofsalesperson='+dl.proofsalesperson.value+'&proofclear='+dl.proofclear.value+'&proofstore='+dl.proofstore.value+'&prooffaxcheck='+dl.prooffaxcheck.value+'&prooffax='+dl.prooffax.value+'&proofemailcheck='+dl.proofemailcheck.value+'&proofemail='+dl.proofemail.value+'&notes='+dl.notes.value+'&loginname='+dl.loginname.value+'&proofneedby='+dl.proofneedby.value; return false;">

<input type="submit" name="submit" value="Submit" border="0">

</a>


All of these values I could duplicate in a regular html link, except the &array='+build()+' value.

The build() function gets an array from javascript and makes it useable in a link.

::

function build() {

var ary = new Array(), opts = document.testForm.dateList.options;

for (i=0; i<opts.length; i++) {

ary[ary.length] = opts[i].value;

}



return ary;

}





Any ideas?
Copy linkTweet thisAlerts:
@tcovertauthorJan 08.2004 — Should the window.location.href function work in Internet Explorer 6?
Copy linkTweet thisAlerts:
@oleragJan 08.2004 — There'es the editor - long length thread here.

Another option (whether a button or an anchor) is to call a

JS function that preps all of your arg vals into a string and

then call the desired page via the window.open() function.

You'll need to formulate the string in CGI format.

To open in a new window use "_blank" or, to replace the

existing window, "_
self".
×

Success!

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