Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

How to simulate a button click with JavaScript ....

Javascript coding ..

Moderators: macek, egami, gesf

How to simulate a button click with JavaScript ....

Postby WoozyDuck » Sun Aug 15, 2004 3:10 pm

How to simulate a button click with JavaScript ....
Well ive found this which we can do it in JS ...

buttonName.click();

It works fine in INTERNET EXPLORER ,
but it doesnt work in NETSCAPE ,

Anybody can give me a same code which works in NS ?
User avatar
WoozyDuck
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby ruturajv » Sun Aug 15, 2004 7:31 pm

Code: Select all
document.forms[0].button_name.click()

this does work... Check the js 1.3 reference
http://devedge.netscape.com/library/man ... utton.html
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby WoozyDuck » Mon Aug 16, 2004 4:44 am

it doesnt work in Netscape ...

Code: Select all
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>

<form name="test" method="POST" enctype="multipart/form-data" action="--WEBBOT-SELF--">
  <p>
    <input name="browse" type="file" name="F1" size="20">
  </p>
  <p>
    <input type="button" onclick="document.forms[0].browse.click();" value="Click Browse ..." name="B1">
     
  </p>
</form>

</body>
</html>

User avatar
WoozyDuck
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby ruturajv » Mon Aug 16, 2004 7:34 pm

It seems you are using Netscape version which does not supoort Javascript 1.3 or you have disabled Javascript in your Netscape...
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby gesf » Tue Aug 17, 2004 3:49 am

This should work:
Code: Select all
document.forms[0].submit()
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron