CodeIgniter Forums
CodeIgniter+javascript+IE - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: CodeIgniter+javascript+IE (/showthread.php?tid=1716)



CodeIgniter+javascript+IE - El Forum - 06-21-2007

[eluser]Unknown[/eluser]
Hello!

I have a application with a menubar anda a secundary left menu that is called by a simple innerHTML javascript.
the code is

the extract of view file:

<div id="menu">
<ul id="menubarra">
<li>&lt;a onclick="montamenu('ensino')"&gt;ensino</a></li>
<li>&lt;a onclick="montamenu('pesquisa')"&gt;pesquisa</a></li>
<li>&lt;a onclick="montamenu('extensao')"&gt;extens&atilde;o</a></li>
</ul>
</div>
</div>
<div id="menuesquerda"> // the div to put the secundary menu.
</div>

the javascript code:


function montamenu(menu) {
if (menu=='ensino') {
var leftmenu = "<ul><li><a href="+base_url+"ensino/habilitacoes>habilita&ccedil;&otilde;es</a></li>"+
"<li><a href="+base_url+"ensino/disciplinas>disciplinas</a></li>"+
"<li><a href="+base_url+"ensino/docentes>docentes</a></li>"+
"<li><a href="+base_url+"ensino/vestibular>Informa&ccedil;&otilde;es ao vestibulando</a></li></ul>"
} else if (menu=='pesquisa')
{
var leftmenu = "<ul><li><a href="+base_url+"pesquisa/projetos>Projetos em Andamento</a></li>"+
"<li><a href="+base_url+"pesquisa/publicacoes'>Publica&ccedil;&otilde;es</a></li>"+
"<li><a href="+base_url+"pesquisa/tcc>TCC&acute;S dos Alunos</a></li></ul>"
}
else {
var leftmenu = "<ul><li><a href="+base_url+"extensao/projetos>Projetos em Andamento</a></li>"
}
document.getElementById("menuesquerda").innerHTML=leftmenu
}


the question is:

In the firefox browser everething is ok but they don´t work in IE.

Someone could help?
Thanks!


CodeIgniter+javascript+IE - El Forum - 06-22-2007

[eluser]Bulk[/eluser]
Any javascript errors in IE?


CodeIgniter+javascript+IE - El Forum - 06-22-2007

[eluser]giaodn[/eluser]
This is JavaScript problem, there no relation to CI + JS. I try to debug and the code below is the code that run correctly in both IE and FI, hope it useful for you:

Crying, try to post the html code for you but i can't because of the post function cannot handle HTML code correctly Sad, sorry


CodeIgniter+javascript+IE - El Forum - 06-22-2007

[eluser]Unknown[/eluser]
[quote author="giaodn" date="1182526962"]This is JavaScript problem, there no relation to CI + JS. I try to debug and the code below is the code that run correctly in both IE and FI, hope it useful for you:

Crying, try to post the html code for you but i can't because of the post function cannot handle HTML code correctly Sad, sorry[/quote]


It´s possible send me the HTML code by mail in
rsr.bgt at ig.com.br ?
Or, where I can find some documentation of IE Javascript padronization?

Thanks


CodeIgniter+javascript+IE - El Forum - 06-28-2007

[eluser]Unknown[/eluser]
Dear Rael, I think it does work, but it was postback because you don't put return false on event onclick in anchor

There are 2 alternatif for calling javascript function in anchor:
1. &lt;a onclick="montamenu(’ensino’);return false;"&gt;ensino&lt;/a&gt;
2. &lt;a herf="[removed]montamenu(’ensino’)"&gt;ensino&lt;/a&gt;

Hope this will help you.