/    Sign up×
Community /Pin to ProfileBookmark

Pre Populate Text box from Use map

Hi,

Im pretty new to coding and almost finished my first attempt at a webpage.

I have one last thing to complete…I want to populate a textbox from the an area selected on a usemap on a different screen

After digging around forums and reading many website it seems the best way to do this is to use javascript and then create a query string??

Here is an example of the usemap code

<map name=”R8Top2″>

<area shape=”RECT” coords=”204,205,214,215″ href=”newpage.aspx” title=”Box 1″ id=”1″>

so I want to click on the area then navigate to ‘newpage.aspx’ and on the page I have navigated to I want a textbox field called ‘boxtxt’ to populate with the id ot ‘1’ (but 2 is I select a different box)

can anyone help?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 04.2008 — Change the href to pass the value&lt;area shape="RECT" coords="204,205,214,215" href="newpage.aspx[COLOR="DarkGreen"]?1[/COLOR]" title="Box 1" id="1"&gt;
Add this to "newpage"
&lt;script type="text/javascript"&gt;
window.onload=function() {
var passed= window.location.split("?");
document.forms[[I]formName[/I]].boxtxt.value=passed[1];
};
&lt;/script&gt;
Copy linkTweet thisAlerts:
@pegleg999authorJun 04.2008 — This doesnt seem to work.

I have added the '?1' to the href

on new page, the field is called txtTopLeft

Where do I find the 'formName'

I get a whole host of errors when I add this to the aspx.vb page (do I add the code to the newpage.aspx or newpage.aspx.vb)?

window.onload=function() {

var passed= window.location.split("?");

document.forms[formname].txtTopLeft.value=passed[1];

};

window is not declared

Name 'var' not declared

Method arguements must be declared by parameters

document is not declared

name 'passed' not declared

any help where Im going wrongs?
Copy linkTweet thisAlerts:
@FangJun 05.2008 — I don't do VB so you will need to check that you are passing data and adding the JavaScript in the correct way. Ask in the relevant forum.
×

Success!

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