corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » vbscript / javascript guru's


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author vbscript / javascript guru's
jamesw
Member

Registered: 28th Jun 02
Location: Station Town, County Durham
User status: Offline
4th Feb 11 at 18:36   View User's Profile U2U Member Reply With Quote

Really cant figure out why this doesnt work. The idea is I have an HTA file, two main spans involved in the issue, one with the ID desc, the other with midhtml.

I then have a vb sub that adds buttons to midhtml, I send parameters to the add button sub such as button name, action, and all that works fine, however what I wanted to do is pass another param that will define a onmouseover event it will set predefined text in the desc span.

E.g. of line to call the button sub is

addbutton "Manage Print Drivers","PRINTDRVS","P","Tooltip to display when hovering over print drivers button"

Here is my addbutton sub

sub addbutton (name,action,kaccesskey,description)
UpdatemidHTML ("<button style=""vertical-align:top"" onMouseOver=""javascript:this.className='button buttonhov';desc.innerHTML=description"" onMouseOut=""javascript:this.className='button'"" onMouseDown=""javascript:this.className='button buttonhov buttondown'"" onclick="""&action&""" accesskey="""&kaccesskey&""" class=""button"">"&name&"</button>")
size = size + 26
end Sub

What tends to happen is nothing is inserted to the desc innerhtml but I cant figure out why, I can do msgbox description and I get the correct description OK, I can also change the code slightly and use a variable that was declared much earlier such as strmachinename e.g. onMouseOver=""javascript:this.className='button buttonhov';desc.innerHTML=strmachinename"" and that also works fine

[Edited on 04-02-2011 by jamesw]
ed
Member

Registered: 10th Sep 03
User status: Offline
6th Feb 11 at 15:18   View User's Profile U2U Member Reply With Quote

You can't add event listeners in that way and you shouldn't use onmouseover tags within html. To add an event listener to the DOM you should do it something like this:

<script>
document.getelementbyid('description').onmouseover=function(){ alert('onmouseover event just happened') }
</script>

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Need a bit of help (HTML) PaulW General Chat 16 1493
5th Jan 04 at 22:48
by VisibleMan
 
bit of coding for a webpage Tantastic Geek Day 4 662
22nd Feb 07 at 23:31
by Tantastic
 
Javascript people Steve Geek Day 0 629
28th Apr 07 at 19:07
by Steve
 
Javascript function changing css? Rus Geek Day 1 646
22nd Jun 07 at 10:53
by Rus
 
Irmsher airdam Corsa_Quadz Help Zone, Modification and ICE Advice 3 477
6th Mar 08 at 07:59
by Fonz
 

Corsa Sport » Message Board » Off Day » Geek Day » vbscript / javascript guru's 28 database queries in 0.0116761 seconds