Monkuar Posted July 4, 2009 Share Posted July 4, 2009 This script works fine in firefox,opera,chrome, everything but it only shows error on ie.. help ? This is my whole function: function sendMessage(id,event) { var itm = expMenu("qm"); goldOn = !goldOn; if(goldOn && itm) { if(itm.innerHTML=="") itm.innerHTML = "</form><legend>Quick Message<a href='javascript:sendMessage()' class='hs'><img src='images!!/x.gif'></a></legend><form action='monkuar.php' name='sendMessageForm' method='POST' target='_blank'><input type='hidden' name='username' value='0' /><table class='ftbt'><tr><td align=right>Message Title:</td><td><input type=text name='title' maxlength=25 size=7></td></tr><tr><td align=right>Message:</td><td><textarea name='message' cols=20 rows=10></textarea></td></tr><tr><td align=center colspan=2><span class=ab><input type='submit' value='Send (0.03 FG)' name='submit' onclick='sendMessage()'></span><br></td></tr><tr></tr></table></form>"; itm.style.left=event.clientX + (window.pageXOffset!=undefined?window.pageXOffset:document.body.scrollLeft)+"px"; itm.style.top=event.clientY + (window.pageYOffset!=undefined?window.pageYOffset:document.body.scrollTop)+"px"; itm.style.zIndex="100"; sendMessageForm.username.value=id; } } Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/ Share on other sites More sharing options...
seventheyejosh Posted July 4, 2009 Share Posted July 4, 2009 i'm not an expert... but after the if(itm.innerHTML=="") shouldnt u have some braces? like if(itm.innerHTML==""){ do stuff }//end if Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-868926 Share on other sites More sharing options...
corbin Posted July 4, 2009 Share Posted July 4, 2009 i'm not an expert... but after the if(itm.innerHTML=="") shouldnt u have some braces? like if(itm.innerHTML==""){ do stuff }//end if In almost every programming/scripting language, the syntax of if is: if(condition) block 1 else block 1 {} simply groups stuff together. Oddly enough, that has the side effect that in most languages: { code here } Is valid in the middle of no where lol. Anyway, does itm happen to be null? Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-868958 Share on other sites More sharing options...
Monkuar Posted July 5, 2009 Author Share Posted July 5, 2009 i'm not an expert... but after the if(itm.innerHTML=="") shouldnt u have some braces? like if(itm.innerHTML==""){ do stuff }//end if In almost every programming/scripting language, the syntax of if is: if(condition) block 1 else block 1 {} simply groups stuff together. Oddly enough, that has the side effect that in most languages: { code here } Is valid in the middle of no where lol. Anyway, does itm happen to be null? yea Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869002 Share on other sites More sharing options...
Monkuar Posted July 5, 2009 Author Share Posted July 5, 2009 ok so i ddi the bracket stuff and now it gives me this.. lmao here is my code that puts that onclick function: <img src="chat.gif" style="cursor:hand" onclick="sendMessage('$id',event)""></a> this isnt happeneing on any other browsers ecept ie.. WOW Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869027 Share on other sites More sharing options...
Monkuar Posted July 5, 2009 Author Share Posted July 5, 2009 Somone please.. IE IS GAY! Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869076 Share on other sites More sharing options...
Monkuar Posted July 6, 2009 Author Share Posted July 6, 2009 Bump lol PLEASE IE IS DUMB THIS WORKS ON CHROME,FIREFOX,OPERA EVERYTHING BESIDES IE!?!? lolollol Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869502 Share on other sites More sharing options...
TheFilmGod Posted July 6, 2009 Share Posted July 6, 2009 It's because you're harding coding everything. Ever heard of jquery? It solves the issues of cross browser compatible. No expert javascript programmers hard code everything. They use frameworks. Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869515 Share on other sites More sharing options...
corbin Posted July 6, 2009 Share Posted July 6, 2009 Sometimes it's not worth the effort to use a framework. Can we see either the full pages or a link? Kind of hard to know the problem otherwise. You need to figure out why itm is null is basically what it comes down to. Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869523 Share on other sites More sharing options...
Adam Posted July 6, 2009 Share Posted July 6, 2009 Sometimes it's not worth the effort to use a framework. I agree, sometimes jQuery and similar can be overkill for simple functionality. Also the 'experts' are likely to be the ones writing the frameworks, you're not exactly going to become an expert using one... Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869656 Share on other sites More sharing options...
KevinM1 Posted July 6, 2009 Share Posted July 6, 2009 Without being able to see more of your code, I have two suggestions: 1. Use brackets with your conditionals. 2. Break up the string you're trying to assign to the innerHTML into smaller strings. JavaScript occasionally has issues with long strings. You should also check to see if itm actually exists in IE. It could be that you're attempting to manipulate the innerHTML of a null object. Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869685 Share on other sites More sharing options...
haku Posted July 6, 2009 Share Posted July 6, 2009 I think it's good to have a good solid understanding of javascript before using a framework, but once you have that understanding, frameworks just make it so much easier to deal with. As for overkill, jquery minified is only 55.9 kb - that's nothing. Implementing it takes all of about 8 seconds to download and type the link in your page. I don't really see it being overkill myself. Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869695 Share on other sites More sharing options...
corbin Posted July 6, 2009 Share Posted July 6, 2009 document.getElementById('something').innerHTML = 'something'; $('#something').html('something'); Whoa! But over a large project, jQuery will definitely save time. Was just saying I don't think he should switch to jQuery just because 1 call isn't working in IE. If the rest of his project is large, then perhaps it would be worth it. I still think it's pointless sometimes though. Quote Link to comment https://forums.phpfreaks.com/topic/164748-only-error-i-get-is-in-internet-exploror-lmao/#findComment-869849 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.