Click to See Complete Forum and Search --> : Button with onClick-link ??
alexclick
01-08-2003, 12:30 PM
Hello,
I have a simple question, but I don't know the answer:confused:
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
;) ;)
gil davis
01-08-2003, 01:05 PM
The "onclick" requires a JavaScript statement. All you gave it is a filename string.
<input ... onclick="window.location.href='orderpage.html'">
Charles
01-08-2003, 01:56 PM
Of course, that will fail one in ten times. If you want something that will actually work then try:
<form action="orderpage.htm">
<div><input type="syubmit"></div>
</form>
alexclick
01-08-2003, 02:05 PM
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>
Zach Elfers
01-08-2003, 02:07 PM
Why don't you give a link to your code or use Charles idea?
alexclick
01-08-2003, 02:12 PM
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.
gil davis
01-08-2003, 02:13 PM
Originally posted by Charles
Of course, that will fail one in ten times. If you want something that will actually work then try:
<form action="orderpage.htm">
<div><input type="syubmit"></div>
</form>
Hmmm... Your idea will fail 100% of the time due to your atrocious spelling.
gil davis
01-08-2003, 02:14 PM
Originally posted by alexclick
my script is not online yet.
Change the extension of the file to .txt and attach it to a new reply.
alexclick
01-08-2003, 02:17 PM
Here's the file, line 221.
Zach Elfers
01-08-2003, 02:23 PM
What if you did:
<form name="whatever" onSubmit="function();">
<input type="submit" name="Submit" value="Submit">
</form>
alexclick
01-08-2003, 02:31 PM
I get the error-message:
Description: ')'
alexclick
01-08-2003, 02:32 PM
sorry, Description: ')' expected
Zach Elfers
01-08-2003, 02:35 PM
Does it give a line?
Zach Elfers
01-08-2003, 02:35 PM
Try changing function() to self.location.href='page.html';
alexclick
01-08-2003, 02:37 PM
line 181 and line 221
Charles
01-08-2003, 03:41 PM
Originally posted by gil davis
Hmmm... Your idea will fail 100% of the time due to your atrocious spelling. That was a typographical error, not a spellographical one.