...

View Full Version : Javascript function



csam0003
03-25-2009, 02:35 AM
hi all,

I have a javascript function that inputs span tags around some text in any web page I access. In between these tags, I put onmouseover = Somefunction().
This "Somefunction()" is stored in the same js file which does the insertion.

However I noticed that nothing is happening as Somefunction() is not defined.
Do i have to insert the Somefunction() into the webpage aswell or is there a way I can direct the call to the function in the javascript file?

Thanks alot

Regards
Chris

TinyScript
03-25-2009, 02:58 AM
sounds like it. All yoiu need to do is include script tags with the src

csam0003
03-25-2009, 11:05 AM
Thank you TinyScript for your reply.
I really appreciate it.

Can u explain a bit better where I have to put the script and src.

My code is the following:

function something()

wArea = content.document.getElementsByTagName('body')[0];
var openTag = '<span onMouseOver = "testButton()" >';
var closetag = '</span>';
workText = content.getSelection().getRangeAt(0);
var currReplace = new RegExp("("+workText+")");
wArea.innerHTML = wArea.innerHTML.replace(currReplace, openTag+"$1"+closeTag);

As you can see, I am inserting the onmouseover = testButton() as a string in the web page. The function testbutton() is saved in the same js file as function something(). This something() is called when the user clicks on a button I created in Firefox toolbar.

thank you for your time



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum