Jump to content

Recommended Posts

This script works fine in firefox,opera,chrome, everything but it only shows error on ie..

 

help ?

2djdrwl.jpg

 

 

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;
}
}

 

 

 

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?

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

ok so i ddi the bracket stuff and now it gives me this.. lmao fbat6g.jpg    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

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...

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.