[Javascript] button?
tedd
tedd at sperling.com
Thu Jun 15 12:44:39 CDT 2006
>tedd wrote:
>>Hi:
>>
>>Why does:
>>
>> <input type="button" value = "Upload" onclick="window.location='up.php' ">
>>
>>work, while:
>>
>> <button onclick="window.location='up.php' ">Upload</button>
>>
>>doesn't ?
>>
>>What js could I use with <button> to do the same thing as above with <input type="button">?
>>
>
>You don't say which browser you're having trouble with, but the <button> element has a "type" attribute; try adding type="button" and see if that helps. Also, you might want to add "return false;" to cancel any default action (shouldn't matter with type="button" though), and it's usually recommended to set "window.location.href" - well, recommended by purists like me :-)
>
><button type="button" onclick="window.location.href='up.php'; return false;">Upload</button>
>
>HTH,
>
>Nick.
Bingo !
It was the "type" attribute I was missing -- when I added that, everything worked !!!! : -)
I'll review the "window.location.href" thing.
As they say in php:
<?php
echo str_repeat("Thank You !", 100);
?>
tedd
PS: Safari 2.0.3
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
More information about the Javascript
mailing list