/    Sign up×
Community /Pin to ProfileBookmark

Button with onClick-link ??

Hello,

I have a simple question, but I don’t know the answer?

I have a button and want to link this button with a new html-page, but it don’t works.

document.write(‘<td width=”49%”><input type=”button” name=”Submit2″ value=”Order” class=”text5″ onClick=”orderpage.html”></td></tr></div>’);

When I click the button I get the error: JavaScript Error Descrition : ‘orderpage’ is undefinied”

Do you can help me?
It would be great.

Greetings

Alex

? ?

to post a comment
JavaScript

15 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 08.2003 — The "onclick" requires a JavaScript statement. All you gave it is a filename string.

[font=courier]<input ... onclick="window.location.href='orderpage.html'">[/font]
Copy linkTweet thisAlerts:
@CharlesJan 08.2003 — [font=georgia]Of course, that will fail one in ten times. If you want something that will actually work then try:

[/font][font=monospace]

<form action="orderpage.htm">

<div><input type="syubmit"></div>

</form>[/font]
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — hm, this don't works, I get an error-message, too:

document.write('<td width="49%"><input type="button" name="Submit" value="order" class="text5" onclick="window.location.href='orderpage.html'"></td></div>');

this line is inside a <form> and inside the <javascript>
Copy linkTweet thisAlerts:
@Zach_ElfersJan 08.2003 — Why don't you give a link to your code or use Charles idea?
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — my script is not online yet.

to charles: I use a form-tag, but I don't want to use one more form-tag inside these.
Copy linkTweet thisAlerts:
@gil_davisJan 08.2003 — [i]Originally posted by Charles [/i]

[B]Of course, that will fail one in ten times. If you want something that will actually work then try:

[font=monospace]

<form action="orderpage.htm">

<div><input type="syubmit"></div>

</form>[/font][/B]
[/QUOTE]

Hmmm... Your idea will fail 100% of the time due to your atrocious spelling.
Copy linkTweet thisAlerts:
@gil_davisJan 08.2003 — [i]Originally posted by alexclick [/i]

[B]my script is not online yet.[/B][/QUOTE]

Change the extension of the file to .txt and attach it to a new reply.
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — Here's the file, line 221.

[upl-file uuid=1a4a1412-7c8c-4db6-a876-a9d0c7230556 size=11kB]basket.txt[/upl-file]
Copy linkTweet thisAlerts:
@Zach_ElfersJan 08.2003 — What if you did:

<form name="whatever" onSubmit="function();">

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

</form>
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — I get the error-message:

Description: ')'
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — sorry, Description: ')' expected
Copy linkTweet thisAlerts:
@Zach_ElfersJan 08.2003 — Does it give a line?
Copy linkTweet thisAlerts:
@Zach_ElfersJan 08.2003 — Try changing function() to self.location.href='page.html';
Copy linkTweet thisAlerts:
@alexclickauthorJan 08.2003 — line 181 and line 221
Copy linkTweet thisAlerts:
@CharlesJan 08.2003 — [i]Originally posted by gil davis [/i]

[B]Hmmm... Your idea will fail 100% of the time due to your atrocious spelling. [/B][/QUOTE]
[font=georgia]That was a typographical error, not a spellographical one.[/font]
×

Success!

Help @alexclick 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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