/    Sign up×
Community /Pin to ProfileBookmark

"Javascript", How to use the passed arguement in the function

Hi, I’m trying to write a little function that will accept an arguement as follows:

function FloorPlan(plan)

{
FloorPlanWindow= window.open(“”,”FWin1″,”width=550,height=550,left=100,top=0″);
FloorPlanWindow.document.write(“<HTML><HEAD></HEAD><BODY BGCOLOR=’e0d9aa’><center><IMG SRC=’plan’></center><br><center><a href=’javascript:window.close()”>Close Window</a></center></BODY></HTML>”);

FloorPlanWindow.focus();
}

I’m calling this function from this link:
<a href=”javascript:FloorPlan(‘images/A1_1br-1ba.jpg’)”>C1</a>

What am i doing wrong coz the passed arguement does not work.How do i use “plan” (passed arguement) in the code to write html to the window.

Please someone help!
Thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyFeb 15.2006 — FloorPlanWindow.document.write("&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY BGCOLOR='e0d9aa'&gt;&lt;center&gt;&lt;IMG SRC='"+plan+"'&gt;&lt;/center&gt;&lt;br&gt;&lt;center&gt;&lt;a href='javascript:window.close()''&gt;Close Window&lt;/a&gt;&lt;/center&gt;&lt;/BODY&gt;&lt;/HTML&gt;");
Copy linkTweet thisAlerts:
@jamFeb 15.2006 — this is simple you cant have your argument instance in quote marks try:

[CODE]
FloorPlanWindow= window.open("","FWin1","width=550,height=550,left=100,top=0");
FloorPlanWindow.document.write("<HTML><HEAD></HEAD><BODY BGCOLOR='e0d9aa'><center><IMG SRC='[COLOR=Red]"+plan+"[/COLOR]'></center><br><center><a href='javascript:window.close()''>Close Window</a></center></BODY></HTML>");
[/CODE]


i thin that'lll work but im not sure att you'r doing is closing the double brackets accepting the argument and adding more to the string
×

Success!

Help @fozail 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 4.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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...