hello friends, please let me know what's wrong with this script. <SCRIPT LANGUAGE = "JavaScript"> <!-- var browsername = navigator.appName; if (browsername == "Netscape") { browsername = "navigator"; <INPUT TYPE="submit" name="press"> alert('you are using' + browsername); } else if (browsername == "Microsoft Internet Explorer") { browsername= "msie"; <INPUT TYPE="submit" name = "click"> alert('you are using' + browsername); } //--> </SCRIPT>
You are mixing javascript with HTML. You can't have HTML code directly written in your javascript code. So it is the <input> tags in your javascript that is causing the main error. What you want is to have the javascript in your head, and then have the form below. When someone clicks on the button, run the function in your javascript. Bill
Thanks bill. But i have one more doubt. what i am trying to do here is when you give <INPUT TYPE=file name =file> that will give you a textbox to directly type in the file name and a browse button right. Here i want to disable the textbox part so, that the user can only use the browse button. For that i tried using <INPUT TYPE= file NAME=file READONLY=true>.This piece of line only works in IE but in netscape i can still type into the textbox. I really need your help here. This is kind of urgent for me. Please help me. Thanks a lot in advance. Pranavi p.
Netscape doesn't support READONLY as you have just seen. You can simulate it with have an onblur() method called when the input box gets focus. So you can say this:
Haven't done much testing on Netscape 6 yet. Can't help there. Netscape 6 is still so new and not many users have it yet, so I am still going with Netscape 4.0 and up (but not to 6.0 yet) and IE 4.0 and up. Bill
Hi Pranavi, Can you try using javascript to do this... Try something like this.. On focus of the texbox call a javascript function to set the focus to browse button, thereby making textbox1 as disabled.Try if this works out...
Kind Regards,<BR>Chandra Priya.T
My cellmate was this tiny ad:
a bit of art, as a gift, that will fit in a stocking