Bug 27988 - Assigning functions to javascript events does not work
Summary: Assigning functions to javascript events does not work
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
Depends on:
Reported: 2001-07-01 22:18 UTC by djoham
Modified: 2002-09-16 14:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description djoham 2001-07-01 22:03:26 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kjs
Version:           KDE 2.2.0 CVS/CVSup/Snapshot
Severity:          normal
Installed from:    Compiled sources
Compiler:          GCC 2.96
OS:                Linux
OS/Compiler notes: Not Specified

This bug may be related to bug 20165 but I can't really reproduce what he was trying to say so I'm logging this myself.

I'm using KDE from 30 June CVS

I'm trying to get HeirMenus from DHTML labs working in Konqi. These are the most popular javascript menus on the web to my knowledge. There seem to be a lot of problems with Konqi so I'm going to log the bugs one at a time.

The issue with this bug is that Konqueror will not allow you to set a custom function for window.onload. The following HTML will show an alert box in Mozilla NN4 and IE

when working properly an alert box that says "hello world" should pop up
<script language="javascript">
window.onload = function(){showAlert()};

function showAlert() {
        alert("hello world");


the error that is reported by Konqi from the output is: "JavaScript parse error at line 1."

This is how the javascript menus get started. Without support for this function no menus are ever created.

I've worked around this bug for now so that I can continue testing but in order to support those menus we'll need to fix this problem.

If we can fix this problem it will go a long way towards geting rid of many of the annoying "javascript menus not working" bugs that we recieve...

If you need further information please contact me at djoham@yahoo.com


(Submitted via bugs.kde.org)
(Called from KBugReport dialog. Fields Application KDE Version OS Compiler manually changed)
Comment 1 djoham 2001-07-02 05:44:44 UTC
I've investigated further and found another similar
bug that's close enough to be placed here. Let me know
if you would like to have this in its own bug...

It looks like Konqi won't let you set any of the even
handlers for elements native events. The menus create
a new div and then assign onclick onmouseover and
onmouseout events to handle mouse input. Konqi seems
to ignore these assignments. Run the following code in
Mozilla. It works as expected. Konqi creates the DIV
but then does nothing else...

<input type="button" id="button" value="createDiv"

<script language="javascript">

function createDiv() {
        var x = document.createElement("DIV");
        x.id = "newDiv";
        x.style.position = "absolute";
        x.style.height = "200px";
        x.style.width =  "200px";
        x.style.top = "200px";
        x.style.left = "200px";
        x.style.backgroundColor = "red";
        x.innerHTML = "hello";
        x.onclick = charlie;
        x.onmouseover = mouseOver;
        x.onmouseout = mouseOut;
        document.getElementById("button").disabled =

function charlie() {
        alert("Hi I'm charlie");

function mouseOver() {
= "blue";

function mouseOut() {
= "red";


Thanks. Please let me know if there is anything else I
can do to help.


Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
Comment 2 Harri Porten 2002-03-03 13:55:35 UTC
Works now. Added the two testcases to our repository btw.