/    Sign up×
Community /Pin to ProfileBookmark

what is wrong in this script?

What is wrong in this script? ?

<body>
<form name=”take”>
<table border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”100%”><select name=”take2″ size=”5″>
<option selected value=”http://www.javascriptkit.com”>JavaScript Kit frontpage</option>
<option value=”http://www.javascriptkit.com/javaindex.htm”>JavaScript Tutorials</option>
<option value=”http://www.javascriptkit.com/cutpastejava.htm”>Free JavaScripts</option>
<option value=”http://www.javascriptkit.com/howto/webbuild.htm”>Web Building Tutorials</option>
<option value=”http://www.javascriptkit.com/java/javafront.htm”>Free Java Applets</option>
<option value=”http://www.javascriptkit.com/frontpage.htm”>FrontPage Tutorials</option>
<option value=”http://www.cnn.com”>CNN</option>
<option value=”http://www.microsoft.com”>Microsoft</option>
<option value=”http://www.netscape.com”>Netscape</option>
</select>

<script language=”javascript”>

// custom window function
function open_win(name,w,h)
{
// sets location
url = document.take.take2.options[document.take.take2.selectedIndex].value;

// set vars to center window
froml = (screen.width/2) – (w/2);
fromt = (screen.heigh/2) – (h/2);

set = ‘height=’+h
+ ‘,width=’+w
+ ‘,toolbar=no’
+ ‘,menubar=no’
+ ‘,scrollbars=no’
+ ‘,resizable=no’
+ ‘,location=no’
+ ‘,directories=no’
+ ‘,status=no’
+ ‘,left=’+froml
+ ‘,top=’+fromt;

open(url,name,set);
}
</script>

</td>
</tr>
<tr>
<td width=”100%”><div align=”center”><center><p><input type=”button”
value=”Take Me There!” name=”B1″ onClick=”taking()”></td>
</tr>
</table>
</form>

</body>?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJul 11.2003 — Whats wrong with this script???

The lest you could do is to write down what is it you expect it to do and whats the erro you are getting instead..
Copy linkTweet thisAlerts:
@freefallJul 11.2003 — Well let em give you some hints. First off, you never use the open_win() function. Next, you have the submit button fire a function called taking(), which doesn't exist. When I get home and have some more time I can help you out here if you can't get this yourself.

Also, next time you have a problem with a script, describe the problem, don't just say there is one.

- Ian
Copy linkTweet thisAlerts:
@_LOBO_authorJul 11.2003 — you are right freefall!

and thanks guys for stop here.

the problem:

I want to launch a pop up using this script, the original only launch a new web page.


[URL=http://www.javascriptkit.com/script/cut147.shtml]original script here[/URL]
Copy linkTweet thisAlerts:
@_LOBO_authorJul 11.2003 — I made this and now it works, but the pop up is not centred in the screen, is in the middle but at the top of the screen.


my changes:

[B]<td width="100%"><p><input type="button"

value="Take Me There!" name="B1" onClick="open_win('name',800,600)"></td>[/B]



And someone can tell me if this script is optimized? Thank you
Copy linkTweet thisAlerts:
@Mr_JJul 11.2003 — Its a typo

fromt = (screen.heigh/2) - (h/2);


should be

fromt = (screen.heigh[B]t[/B]/2) - (h/2);
Copy linkTweet thisAlerts:
@_LOBO_authorJul 14.2003 — Thanks Mr. J ?
×

Success!

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