|
-
Aug 2nd, 2012, 02:13 PM
#1
Thread Starter
Addicted Member
Javascript doesen't run on Mozilla firefox
I have some javascript that run on Chrome but on Mozilla firefox it just doesen't work. Here is js code:
Code:
<script type="text/javascript">
function Get_help() {
var info = "/info";
var help = "/help";
var info_website = "This webpage is developed for helping every coder to get most common things he need for making web pages. This webpage is created by Mr.Joker for CSS Help forum members. It's not allowed to use this webpage for your forums. This page is only for members of CSS Help forum.";
var help_website = "To use this webpage you have to type slash (/) and then some word that is allready registred as default value.\n " + "\n" + "List of default values:\n " + "1. /info\n" + "2. /help\n" + "3. /html\n" + "4. /css\n" + "5. /colors\n" + "6. /fonts\n";
var get_input = document.forms[0].search.value;
if (get_input == info) {
document.getElementById('paragraph').innerText = info_website;
} else if(get_input == help) {
document.getElementById('paragraph').innerText = help_website;
}
}
</script>
Then I have a button which should run that javascript but it doesen't only on Mozilla:
Code:
<input type="button" class="button" value="Search" onClick="Get_help();">
And there is paragraph with ID:
Code:
<p id="paragraph"></p>
-
Aug 2nd, 2012, 03:48 PM
#2
Re: Javascript doesen't run on Mozilla firefox
Hi there Mr.Joker,
your problem is "innerText" which, unfortunately, is IE code, 
I would suggest that you replace it with "innerHTML" or the DOM "firstChild.nodeValue".
If you decide to use the DOM option then change this...
Code:
<p id="paragraph"></p>
...to this...
Code:
<p id="paragraph"> </p>
...just to be safe.
Last edited by coothead; Aug 2nd, 2012 at 04:14 PM.
Reason: typing error
~ the original bald headed old fart ~
-
Aug 2nd, 2012, 04:05 PM
#3
Thread Starter
Addicted Member
Re: Javascript doesen't run on Mozilla firefox
Thank you man. I now have to change every \n separator because I have to use break html tag. But it's ok. Thanks again.
-
Aug 2nd, 2012, 04:13 PM
#4
Re: Javascript doesen't run on Mozilla firefox
No problem, you're very welcome. 
~ the original bald headed old fart ~
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|