By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Script working in One Browser and not another

P: 41
Hi,
I have the following two problems.
1. The following script is Working in IE and not in Mozilla Firefox
i.e. it si not setting the value of the textbox.
[HTML]<input type="text" name="notify">
<input type="radio" name="radios" value="First" onclick="return radioClick (event)">
[/HTML]

Expand|Select|Wrap|Line Numbers
  1. function eventTrigger (e) {
  2.     if (! e)
  3.         e = event;
  4.     return e.target || e.srcElement;
  5. }
  6.  
  7. function radioClick (e) {
  8.     var obj = eventTrigger (e);
  9.     var notify = document.getElementById &&
  10.                     document.getElementById ('notify');
  11.     if (notify)
  12.         notify.value = 'You clicked on ' + obj.value;
  13.     return true;
  14. }
  15.  
2.The following script is Working in Mozilla Firefox and not in IE
i.e. it is not calling the Search servlet.
[HTML]<select name="l" onchange=submitForm1();>[/HTML]
Expand|Select|Wrap|Line Numbers
  1. function submitForm1()
  2. {
  3. document.forms[0].action="Search";
  4. document.forms[0].submit();
  5. }
  6.  
Can anybody tell me what are the changes i will have to do to make run both the scripts on any one or both browsers.

Thanks
Oct 26 '07 #1
Share this Question
Share on Google+
4 Replies


Ferris
100+
P: 101
Hi

1st question:

change
<input type="text" name="notify">
into
<input type="text" name="notify" id="notify">


2st question:

change
<select name="l" onchange=submitForm1();>
into
<select name="l" onchange="submitForm1();">


hope it helps.
Oct 26 '07 #2

P: 41
Hi

1st question:

change
<input type="text" name="notify">
into
<input type="text" name="notify" id="notify">


2st question:

change
<select name="l" onchange=submitForm1();>
into
<select name="l" onchange="submitForm1();">


hope it helps.
Hi,

I have used
<input type="text" name="notify" id="notify">
and
<select name="l" onchange="return mouseClick();">

But the result is that it shows only You Clicked On and not the selected value of dropdown.
I am not getting Why?

Thanks
Oct 26 '07 #3

acoder
Expert Mod 15k+
P: 16,027
itgaurav198, please use code tags when posting code:
[CODE=javascript]
JavaScript code here...
[/code]

(Maybe with one line of code, it might be OK not to use code tags, but other than that, always use code tags)
Oct 26 '07 #4

Ferris
100+
P: 101
well,I will paste all my test code here,it does work.

[HTML]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>

<input type="text" id="notify" name="notify">
<input type="radio" name="radios" value="First" onclick="return radioClick (event)">
<form>
<select name="l" onchange="submitForm1();">
<option value="a">a</option>
<option value="a">b</option>
</select>
</form>

<script language="javascript">
function submitForm1()
{
document.forms[0].action="Search";
document.forms[0].submit();
}
function eventTrigger (e) {

if (! e)
e = event;
return e.target || e.srcElement;
}

function radioClick (e) {
var obj = eventTrigger (e);
var notify = document.getElementById &&
document.getElementById ('notify');
if (notify)
{
notify.value = 'You clicked on ' + obj.value;
}
return true;
}
</script>
</body>
</html>

[/HTML]
Oct 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.